![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I have a script that duplicates every record in a Find and modifies the duplicate. At the end, another script runs that duplicates some records again based on a certain parameter. The problem is that when the second script runs, it will only duplicate the original records, not the duplicates, even though the duplicates meet the parameters for the script. Basically, the scripts read like this: {Define Cable} Perform Script "Find and Sort" GoTo Record [First] Loop Clear; [Select1.0::Cable Note] Insert Text [Select1.0::Cable Note; "F"] If [$1.0: irection = 1]Perform Script "Return Circuit Name and Number" # This script searches the record for info to copy from a different field to paste in Else Perform Script "Return Previous Position" #This script searches the previous record for information to copy and paste in End If GoToRecord [Next; Exit After Last] End Loop Perform Script "Create Males" Perform Script "Create Spares" GoTo Record [First] ++End of Script++ {Create Males} GoTo Record [First] Loop Duplicate Record Insert Text [Select1.0::Cable Note; "M"] GoToRecord [Next; Exit After Last] End Loop ++End of Script++ {Create Spares} GoTo Record [First] Loop If [$1.0::Cable > 49] Duplicate Record Insert Text [1.0::Position; "*"] Insert Text [1.0::Number; "*"] Insert Text [1.0: est Pos; "*"]Insert Text [1.0: est Num; "*"]End If GoToRecord [Next; Exit After Last] End Loop ++End of Script++ All the components seem to work individually, but whether run on the master script or not, Create Spares doesn't work on duplictaed records. Thanks for any insight. Joe |
#3
| |||
| |||
|
|
I would first start with eliminating every copy/paste action. It is never a good idea to rely on something that can be changed in a multiple sort of ways. Look into local variables and global variables and set field. Then I would look in what you are wanting to achieve. To me it looks like you are duplicating a lot of fields, then changing a few. Where I would think that a related table would be easier to set up and easier to maintain. Then it looks like the Create Spares script will duplicate an already duplicated record. So now you have three clones of the same record. Ah and now I see the problem. It is the $ sign. This is reserved for variables only. NEVER use ist for anything else! Not for tablenames, fields, layouts, valuelist. NEVER use it except for naming variables. Ursus MammalianF... (AT) gmail (DOT) com> schreef in berichtnews:1171601079.344100.15330 (AT) m58g2000cwm (DOT) googlegroups.com... Hi, I have a script that duplicates every record in a Find and modifies the duplicate. At the end, another script runs that duplicates some records again based on a certain parameter. The problem is that when the second script runs, it will only duplicate the original records, not the duplicates, even though the duplicates meet the parameters for the script. |
#4
| |||
| |||
|
|
Hi, I have a script that duplicates every record in a Find and modifies the duplicate. At the end, another script runs that duplicates some records again based on a certain parameter. The problem is that when the second script runs, it will only duplicate the original records, not the duplicates, even though the duplicates meet the parameters for the script. Basically, the scripts read like this: {Define Cable} Perform Script "Find and Sort" GoTo Record [First] Loop Clear; [Select1.0::Cable Note] Insert Text [Select1.0::Cable Note; "F"] If [$1.0: irection = 1]Perform Script "Return Circuit Name and Number" # This script searches the record for info to copy from a different field to paste in Else Perform Script "Return Previous Position" #This script searches the previous record for information to copy and paste in End If GoToRecord [Next; Exit After Last] End Loop Perform Script "Create Males" Perform Script "Create Spares" GoTo Record [First] ++End of Script++ {Create Males} GoTo Record [First] Loop Duplicate Record Insert Text [Select1.0::Cable Note; "M"] GoToRecord [Next; Exit After Last] End Loop ++End of Script++ {Create Spares} GoTo Record [First] Loop If [$1.0::Cable > 49] Duplicate Record Insert Text [1.0::Position; "*"] Insert Text [1.0::Number; "*"] Insert Text [1.0: est Pos; "*"]Insert Text [1.0: est Num; "*"]End If GoToRecord [Next; Exit After Last] End Loop ++End of Script++ All the components seem to work individually, but whether run on the master script or not, Create Spares doesn't work on duplictaed records. Thanks for any insight. Joe |
#5
| |||
| |||
|
|
Putting aside good naming conventions, your 'Create Spares' script is set to only duplicate those find requests where $1.0::Cable > 49. But you've never set that field to anything while you were in find mode. So it seems you are really trying to test for the field value being >49. If true, then you're script should probably look like this: {Create Spares} GoTo Record [First] Loop Duplicate Record Set Field [$1.0::Cable; ">49"] Set Field [1.0::Position; "*"] Set Field [1.0::Number; "*"] Set Field [1.0: est Pos; "*"]Set Field [1.0: est Num; "*"]GoToRecord [Next; Exit After Last] End Loop ++End of Script++ MammalianF... (AT) gmail (DOT) com wrote: Hi, I have a script that duplicates every record in a Find and modifies the duplicate. At the end, another script runs that duplicates some records again based on a certain parameter. The problem is that when the second script runs, it will only duplicate the original records, not the duplicates, even though the duplicates meet the parameters for the script. Basically, the scripts read like this: {Define Cable} Perform Script "Find and Sort" GoTo Record [First] Loop Clear; [Select1.0::Cable Note] Insert Text [Select1.0::Cable Note; "F"] If [$1.0: irection = 1]Perform Script "Return Circuit Name and Number" # This script searches the record for info to copy from a different field to paste in Else Perform Script "Return Previous Position" #This script searches the previous record for information to copy and paste in End If GoToRecord [Next; Exit After Last] End Loop Perform Script "Create Males" Perform Script "Create Spares" GoTo Record [First] ++End of Script++ {Create Males} GoTo Record [First] Loop Duplicate Record Insert Text [Select1.0::Cable Note; "M"] GoToRecord [Next; Exit After Last] End Loop ++End of Script++ {Create Spares} GoTo Record [First] Loop If [$1.0::Cable > 49] Duplicate Record Insert Text [1.0::Position; "*"] Insert Text [1.0::Number; "*"] Insert Text [1.0: est Pos; "*"]Insert Text [1.0: est Num; "*"]End If GoToRecord [Next; Exit After Last] End Loop ++End of Script++ All the components seem to work individually, but whether run on the master script or not, Create Spares doesn't work on duplictaed records. Thanks for any insight. Joe -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Howard Schlossberg (818) 883-2846 FM Professional Solutions, Inc. Los Angeles FileMaker 8 Certified Developer Associate Member, FileMaker Solutions Alliance |
#6
| |||
| |||
|
|
Hey, I am new to Filemaker and its GUI scripting, so forgive me if it's still a little crude. However, I don't want to force all of the copies to have Cable values of >49. When "Create Males" runs, it makes copies of every record (the original records are set up to be Females, and the database is used to create labels for cables). After it runs, I want "Create Spares" to duplicate both records (male and female) for each cable over 49' long (and modify them slightly so I know which is the spare). Correct me if I am wrong, but the code you suggest will end up creating a spare for every cable in the database. On Feb 16, 12:26 pm, Howard Schlossberg how... (AT) antispahm (DOT) fmprosolutions.com> wrote: Putting aside good naming conventions, your 'Create Spares' script is set to only duplicate those find requests where $1.0::Cable > 49. But you've never set that field to anything while you were in find mode. So it seems you are really trying to test for the field value being >49. If true, then you're script should probably look like this: {Create Spares} GoTo Record [First] Loop Duplicate Record Set Field [$1.0::Cable; ">49"] Set Field [1.0::Position; "*"] Set Field [1.0::Number; "*"] Set Field [1.0: est Pos; "*"]Set Field [1.0: est Num; "*"]GoToRecord [Next; Exit After Last] End Loop ++End of Script++ MammalianF... (AT) gmail (DOT) com wrote: Hi, I have a script that duplicates every record in a Find and modifies the duplicate. At the end, another script runs that duplicates some records again based on a certain parameter. The problem is that when the second script runs, it will only duplicate the original records, not the duplicates, even though the duplicates meet the parameters for the script. Basically, the scripts read like this: {Define Cable} Perform Script "Find and Sort" GoTo Record [First] Loop Clear; [Select1.0::Cable Note] Insert Text [Select1.0::Cable Note; "F"] If [$1.0: irection = 1]Perform Script "Return Circuit Name and Number" # This script searches the record for info to copy from a different field to paste in Else Perform Script "Return Previous Position" #This script searches the previous record for information to copy and paste in End If GoToRecord [Next; Exit After Last] End Loop Perform Script "Create Males" Perform Script "Create Spares" GoTo Record [First] ++End of Script++ {Create Males} GoTo Record [First] Loop Duplicate Record Insert Text [Select1.0::Cable Note; "M"] GoToRecord [Next; Exit After Last] End Loop ++End of Script++ {Create Spares} GoTo Record [First] Loop If [$1.0::Cable > 49] Duplicate Record Insert Text [1.0::Position; "*"] Insert Text [1.0::Number; "*"] Insert Text [1.0: est Pos; "*"]Insert Text [1.0: est Num; "*"]End If GoToRecord [Next; Exit After Last] End Loop ++End of Script++ All the components seem to work individually, but whether run on the master script or not, Create Spares doesn't work on duplictaed records. Thanks for any insight. Joe -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Howard Schlossberg (818) 883-2846 FM Professional Solutions, Inc. Los Angeles FileMaker 8 Certified Developer Associate Member, FileMaker Solutions Alliance |
#7
| |||
| |||
|
|
Fprgive me -- I was under the impression you were still in Find mode, but I guess you've already done your find and are now creating duplicate records (not duplicate find requests, which is what I thought you were doing). I think what threw me off was that you were entering "*" as data into your fields instead of an actual number or position. (Not sure what you're trying to do here.) So as far as that 'spare' script not working, you have: If [$1.0::Cable > 49] Was that just a typo (the dollar sign) in your post here or is that what's actually in the script? If it's a actually in your script, then that indicates a variable which you have never set. Perhaps that is the problem. MammalianF... (AT) gmail (DOT) com wrote: Hey, I am new to Filemaker and its GUI scripting, so forgive me if it's still a little crude. However, I don't want to force all of the copies to have Cable values of >49. When "Create Males" runs, it makes copies of every record (the original records are set up to be Females, and the database is used to create labels for cables). After it runs, I want "Create Spares" to duplicate both records (male and female) for each cable over 49' long (and modify them slightly so I know which is the spare). Correct me if I am wrong, but the code you suggest will end up creating a spare for every cable in the database. On Feb 16, 12:26 pm, Howard Schlossberg how... (AT) antispahm (DOT) fmprosolutions.com> wrote: Putting aside good naming conventions, your 'Create Spares' script is set to only duplicate those find requests where $1.0::Cable > 49. But you've never set that field to anything while you were in find mode. So it seems you are really trying to test for the field value being >49. If true, then you're script should probably look like this: {Create Spares} GoTo Record [First] Loop Duplicate Record Set Field [$1.0::Cable; ">49"] Set Field [1.0::Position; "*"] Set Field [1.0::Number; "*"] Set Field [1.0: est Pos; "*"]Set Field [1.0: est Num; "*"]GoToRecord [Next; Exit After Last] End Loop ++End of Script++ MammalianF... (AT) gmail (DOT) com wrote: Hi, I have a script that duplicates every record in a Find and modifies the duplicate. At the end, another script runs that duplicates some records again based on a certain parameter. The problem is that when the second script runs, it will only duplicate the original records, not the duplicates, even though the duplicates meet the parameters for the script. Basically, the scripts read like this: {Define Cable} Perform Script "Find and Sort" GoTo Record [First] Loop Clear; [Select1.0::Cable Note] Insert Text [Select1.0::Cable Note; "F"] If [$1.0: irection = 1]Perform Script "Return Circuit Name and Number" # This script searches the record for info to copy from a different field to paste in Else Perform Script "Return Previous Position" #This script searches the previous record for information to copy and paste in End If GoToRecord [Next; Exit After Last] End Loop Perform Script "Create Males" Perform Script "Create Spares" GoTo Record [First] ++End of Script++ {Create Males} GoTo Record [First] Loop Duplicate Record Insert Text [Select1.0::Cable Note; "M"] GoToRecord [Next; Exit After Last] End Loop ++End of Script++ {Create Spares} GoTo Record [First] Loop If [$1.0::Cable > 49] Duplicate Record Insert Text [1.0::Position; "*"] Insert Text [1.0::Number; "*"] Insert Text [1.0: est Pos; "*"]Insert Text [1.0: est Num; "*"]End If GoToRecord [Next; Exit After Last] End Loop ++End of Script++ All the components seem to work individually, but whether run on the master script or not, Create Spares doesn't work on duplictaed records. Thanks for any insight. Joe -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Howard Schlossberg (818) 883-2846 FM Professional Solutions, Inc. Los Angeles FileMaker 8 Certified Developer Associate Member, FileMaker Solutions Alliance -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Howard Schlossberg (818) 883-2846 FM Professional Solutions, Inc. Los Angeles FileMaker 8 Certified Developer Associate Member, FileMaker Solutions Alliance |
#8
| |||
| |||
|
|
Well, that's what everyone seems to think, but when I try to remove it, I get an error saying "The specified table cannot be found." (There is only one table in the DB.) I'm new to fmp, but I am an old hand at VBA. What does the $ operator mean? If all it does is define a variable, why can't I delete it since I am in a specific record looking at a specific field? Also, the "*" is an insert, not a replace, so the value then ends with *, and is not replaced by it. It's mostly a visual and sorting flag so I can determine which records are the spares. Thanks for your [continued] help. jf On Feb 16, 2:54 pm, Howard Schlossberg how... (AT) antispahm (DOT) fmprosolutions.com> wrote: Fprgive me -- I was under the impression you were still in Find mode, but I guess you've already done your find and are now creating duplicate records (not duplicate find requests, which is what I thought you were doing). I think what threw me off was that you were entering "*" as data into your fields instead of an actual number or position. (Not sure what you're trying to do here.) So as far as that 'spare' script not working, you have: If [$1.0::Cable > 49] Was that just a typo (the dollar sign) in your post here or is that what's actually in the script? If it's a actually in your script, then that indicates a variable which you have never set. Perhaps that is the problem. MammalianF... (AT) gmail (DOT) com wrote: Hey, I am new to Filemaker and its GUI scripting, so forgive me if it's still a little crude. However, I don't want to force all of the copies to have Cable values of >49. When "Create Males" runs, it makes copies of every record (the original records are set up to be Females, and the database is used to create labels for cables). After it runs, I want "Create Spares" to duplicate both records (male and female) for each cable over 49' long (and modify them slightly so I know which is the spare). Correct me if I am wrong, but the code you suggest will end up creating a spare for every cable in the database. On Feb 16, 12:26 pm, Howard Schlossberg how... (AT) antispahm (DOT) fmprosolutions.com> wrote: Putting aside good naming conventions, your 'Create Spares' script is set to only duplicate those find requests where $1.0::Cable > 49. But you've never set that field to anything while you were in find mode. So it seems you are really trying to test for the field value being >49. If true, then you're script should probably look like this: {Create Spares} GoTo Record [First] Loop Duplicate Record Set Field [$1.0::Cable; ">49"] Set Field [1.0::Position; "*"] Set Field [1.0::Number; "*"] Set Field [1.0: est Pos; "*"]Set Field [1.0: est Num; "*"]GoToRecord [Next; Exit After Last] End Loop ++End of Script++ MammalianF... (AT) gmail (DOT) com wrote: Hi, I have a script that duplicates every record in a Find and modifies the duplicate. At the end, another script runs that duplicates some records again based on a certain parameter. The problem is that when the second script runs, it will only duplicate the original records, not the duplicates, even though the duplicates meet the parameters for the script. Basically, the scripts read like this: {Define Cable} Perform Script "Find and Sort" GoTo Record [First] Loop Clear; [Select1.0::Cable Note] Insert Text [Select1.0::Cable Note; "F"] If [$1.0: irection = 1]Perform Script "Return Circuit Name and Number" # This script searches the record for info to copy from a different field to paste in Else Perform Script "Return Previous Position" #This script searches the previous record for information to copy and paste in End If GoToRecord [Next; Exit After Last] End Loop Perform Script "Create Males" Perform Script "Create Spares" GoTo Record [First] ++End of Script++ {Create Males} GoTo Record [First] Loop Duplicate Record Insert Text [Select1.0::Cable Note; "M"] GoToRecord [Next; Exit After Last] End Loop ++End of Script++ {Create Spares} GoTo Record [First] Loop If [$1.0::Cable > 49] Duplicate Record Insert Text [1.0::Position; "*"] Insert Text [1.0::Number; "*"] Insert Text [1.0: est Pos; "*"]Insert Text [1.0: est Num; "*"]End If GoToRecord [Next; Exit After Last] End Loop ++End of Script++ All the components seem to work individually, but whether run on the master script or not, Create Spares doesn't work on duplictaed records. Thanks for any insight. Joe -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Howard Schlossberg (818) 883-2846 FM Professional Solutions, Inc. Los Angeles FileMaker 8 Certified Developer Associate Member, FileMaker Solutions Alliance -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Howard Schlossberg (818) 883-2846 FM Professional Solutions, Inc. Los Angeles FileMaker 8 Certified Developer Associate Member, FileMaker Solutions Alliance |
#9
| |||
| |||
|
|
Well, that's what everyone seems to think, but when I try to remove it, I get an error saying "The specified table cannot be found." (There is only one table in the DB.) I'm new to fmp, but I am an old hand at VBA. What does the $ operator mean? If all it does is define a variable, why can't I delete it since I am in a specific record looking at a specific field? Also, the "*" is an insert, not a replace, so the value then ends with *, and is not replaced by it. It's mostly a visual and sorting flag so I can determine which records are the spares. Thanks for your [continued] help. jf On Feb 16, 2:54 pm, Howard Schlossberg how... (AT) antispahm (DOT) fmprosolutions.com> wrote: Fprgive me -- I was under the impression you were still in Find mode, but I guess you've already done your find and are now creating duplicate records (not duplicate find requests, which is what I thought you were doing). I think what threw me off was that you were entering "*" as data into your fields instead of an actual number or position. (Not sure what you're trying to do here.) So as far as that 'spare' script not working, you have: If [$1.0::Cable > 49] Was that just a typo (the dollar sign) in your post here or is that what's actually in the script? If it's a actually in your script, then that indicates a variable which you have never set. Perhaps that is the problem. MammalianF... (AT) gmail (DOT) com wrote: Hey, I am new to Filemaker and its GUI scripting, so forgive me if it's still a little crude. However, I don't want to force all of the copies to have Cable values of >49. When "Create Males" runs, it makes copies of every record (the original records are set up to be Females, and the database is used to create labels for cables). After it runs, I want "Create Spares" to duplicate both records (male and female) for each cable over 49' long (and modify them slightly so I know which is the spare). Correct me if I am wrong, but the code you suggest will end up creating a spare for every cable in the database. On Feb 16, 12:26 pm, Howard Schlossberg how... (AT) antispahm (DOT) fmprosolutions.com> wrote: Putting aside good naming conventions, your 'Create Spares' script is set to only duplicate those find requests where $1.0::Cable > 49. But you've never set that field to anything while you were in find mode. So it seems you are really trying to test for the field value being >49. If true, then you're script should probably look like this: {Create Spares} GoTo Record [First] Loop Duplicate Record Set Field [$1.0::Cable; ">49"] Set Field [1.0::Position; "*"] Set Field [1.0::Number; "*"] Set Field [1.0: est Pos; "*"]Set Field [1.0: est Num; "*"]GoToRecord [Next; Exit After Last] End Loop ++End of Script++ MammalianF... (AT) gmail (DOT) com wrote: Hi, I have a script that duplicates every record in a Find and modifies the duplicate. At the end, another script runs that duplicates some records again based on a certain parameter. The problem is that when the second script runs, it will only duplicate the original records, not the duplicates, even though the duplicates meet the parameters for the script. Basically, the scripts read like this: {Define Cable} Perform Script "Find and Sort" GoTo Record [First] Loop Clear; [Select1.0::Cable Note] Insert Text [Select1.0::Cable Note; "F"] If [$1.0: irection = 1]Perform Script "Return Circuit Name and Number" # This script searches the record for info to copy from a different field to paste in Else Perform Script "Return Previous Position" #This script searches the previous record for information to copy and paste in End If GoToRecord [Next; Exit After Last] End Loop Perform Script "Create Males" Perform Script "Create Spares" GoTo Record [First] ++End of Script++ {Create Males} GoTo Record [First] Loop Duplicate Record Insert Text [Select1.0::Cable Note; "M"] GoToRecord [Next; Exit After Last] End Loop ++End of Script++ {Create Spares} GoTo Record [First] Loop If [$1.0::Cable > 49] Duplicate Record Insert Text [1.0::Position; "*"] Insert Text [1.0::Number; "*"] Insert Text [1.0: est Pos; "*"]Insert Text [1.0: est Num; "*"]End If GoToRecord [Next; Exit After Last] End Loop ++End of Script++ All the components seem to work individually, but whether run on the master script or not, Create Spares doesn't work on duplictaed records. Thanks for any insight. Joe -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Howard Schlossberg (818) 883-2846 FM Professional Solutions, Inc. Los Angeles FileMaker 8 Certified Developer Associate Member, FileMaker Solutions Alliance -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Howard Schlossberg (818) 883-2846 FM Professional Solutions, Inc. Los Angeles FileMaker 8 Certified Developer Associate Member, FileMaker Solutions Alliance |
#10
| |||
| |||
|
|
Well, that's what everyone seems to think, but when I try to remove it, I get an error saying "The specified table cannot be found." (There is only one table in the DB.) I'm new to fmp, but I am an old hand at VBA. What does the $ operator mean? If all it does is define a variable, why can't I delete it since I am in a specific record looking at a specific field? Also, the "*" is an insert, not a replace, so the value then ends with *, and is not replaced by it. It's mostly a visual and sorting flag so I can determine which records are the spares. Thanks for your [continued] help. jf |
![]() |
| Thread Tools | |
| Display Modes | |
| |