![]() | |
#11
| |||
| |||
|
|
You need to go to the relation graph and change the name of the table occurrence so that it does not begin with a dollar sign. This should be an illegal character to start a TO or field name with. Once you make the modification there, then you should be able to go back to your script and see that it has (possibly) also been removed from there. If it wasn't automaticvally removed from there, then you should now be able to manually remove it or at least select the correct relationship/field name from the dropdown lists. One $ indicates a local variable. Two $$ indicates a global variable. MammalianF... (AT) gmail (DOT) com wrote: 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 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Howard Schlossberg (818) 883-2846 FM Professional Solutions, Inc. Los Angeles FileMaker 8 Certified Developer Associate Member, FileMaker Solutions Alliance |
#12
| |||
| |||
|
|
Define Database > Relationships tab and look for any items on there whose name begins with a dollar sign. Double-click on it to rename |
|
When I select the "Cable" field in the "If" dialog box, it comes up with the $. I don't know why, it just does. If I try and delete it manually, fm tells me "The spceified table cannot be found" On Feb 16, 3:22 pm, Howard Schlossberg how... (AT) antispahm (DOT) fmprosolutions.com> wrote: You need to go to the relation graph and change the name of the table occurrence so that it does not begin with a dollar sign. This should be an illegal character to start a TO or field name with. Once you make the modification there, then you should be able to go back to your script and see that it has (possibly) also been removed from there. If it wasn't automaticvally removed from there, then you should now be able to manually remove it or at least select the correct relationship/field name from the dropdown lists. One $ indicates a local variable. Two $$ indicates a global variable. MammalianF... (AT) gmail (DOT) com wrote: 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. |
#13
| |||
| |||
|
|
Welcome to Filemaker. Have you created this db from scratch or have you inherited it? I'm confused about the error message you're getting. In FM, you have tables which contain fields, and you have table occurances (TOs) which are representations of table. So, you can have one table, but different occurances of it in your relationship graph (with different names). Assuming you only have 1 TO of your 1 table, what is it named? It looks like (based on other fields in the script) that it is named 1.0, so removing the $ should work, if the field Cable exists in that table. Regardless, instead of removing the $ from the field, you should select the appropriate field from the list of fields presented in the calculation box. Also: Instead of using * in the field, I would create a new field named "Spares" of type number and set that to 1 for the spares and empty for non-spares. You can manipulate that field much easier than one with an asterisk in a text field that is already serving a purpose. If you insist on using the flag, I would still use Set Field(fieldName) = fieldName & "*" Another tip is instead of going through each record and testing to see if the length meets you're criteria, and then duplicating, you can do a find on all records pulling a set of the ones with your specified length and duplicate those, eliminating the If statement. G On Feb 16, 1:00 pm, MammalianF... (AT) gmail (DOT) com wrote: 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 |
#14
| |||
| |||
|
|
It is coming up t hat way because that's how you have it defined for the table occurrence that shows in the relation graph. Go to the File menu Define Database > Relationships tab and look for any items on there whose name begins with a dollar sign. Double-click on it to rename without the dollar sign. No go back to your script and you should be able to save it without the dollar sign. |
#15
| |||
| |||
|
|
On Feb 17, 11:18 am, Howard Schlossberg how... (AT) antispahm (DOT) fmprosolutions.com> wrote: It is coming up t hat way because that's how you have it defined for the table occurrence that shows in the relation graph. Go to the File menu Define Database > Relationships tab and look for any items on there whose name begins with a dollar sign. Double-click on it to rename without the dollar sign. No go back to your script and you should be able to save it without the dollar sign. None of the fields (including Cable) has $ in the title. The only thing I see in that window is a box for the table (1.0) and the names of the fields. |
#16
| |||
| |||
|
|
I just tested and it seems what you are probably getting in the If[] step is ${1.0}. The system should see this as a table rather than a variable. Nonetheless, you will avoid these problems if you rename your table occurrence so that they do not begin with a number. In fact, if you tried to rename fields or table occurrences beginning with a number, you will get an error message. It will let you continue like that, but it is not recommended. MammalianF... (AT) gmail (DOT) com wrote: On Feb 17, 11:18 am, Howard Schlossberg how... (AT) antispahm (DOT) fmprosolutions.com> wrote: It is coming up t hat way because that's how you have it defined for the table occurrence that shows in the relation graph. Go to the File menu Define Database > Relationships tab and look for any items on there whose name begins with a dollar sign. Double-click on it to rename without the dollar sign. No go back to your script and you should be able to save it without the dollar sign. None of the fields (including Cable) has $ in the title. The only thing I see in that window is a box for the table (1.0) and the names of the fields. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Howard Schlossberg (818) 883-2846 FM Professional Solutions, Inc. Los Angeles FileMaker 8 Certified Developer Associate Member, FileMaker Solutions Alliance |
#17
| |||
| |||
|
|
On Feb 17, 11:36 am, Howard Schlossberg how... (AT) antispahm (DOT) fmprosolutions.com> wrote: I just tested and it seems what you are probably getting in the If[] step is ${1.0}. The system should see this as a table rather than a variable. Nonetheless, you will avoid these problems if you rename your table occurrence so that they do not begin with a number. In fact, if you tried to rename fields or table occurrences beginning with a number, you will get an error message. It will let you continue like that, but it is not recommended. MammalianF... (AT) gmail (DOT) com wrote: On Feb 17, 11:18 am, Howard Schlossberg how... (AT) antispahm (DOT) fmprosolutions.com> wrote: It is coming up t hat way because that's how you have it defined for the table occurrence that shows in the relation graph. Go to the File menu Define Database > Relationships tab and look for any items on there whose name begins with a dollar sign. Double-click on it to rename without the dollar sign. No go back to your script and you should be able to save it without the dollar sign. None of the fields (including Cable) has $ in the title. The only thing I see in that window is a box for the table (1.0) and the names of the fields. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Howard Schlossberg (818) 883-2846 FM Professional Solutions, Inc. Los Angeles FileMaker 8 Certified Developer Associate Member, FileMaker Solutions Alliance Hi, None of the fields begin with a number. All of the fields are named entirely with letters except one which contains a #, but that field hasn't given me any trouble. I don't really know what a table occurence is, but if it's in the "Realtionships" tab of the Define Database windows, there are no numbers in there, either. I tried changing the name of the table (1.0) to "Main," which didn't help any part of the situation. I also tried avoiding the If statement, doing a find on long cables and running the script again, and that didn't do it either. There must be something in the way the records pile up as the loop executes.... |
![]() |
| Thread Tools | |
| Display Modes | |
| |