February 20, 201510 yr I'm trying to use variables in scripted finds but it appears that the Perform Find step cannot parse repetition references correctly like other FM functions can. Example: $var = "Active" $var[2] = "Web" If I try to insert these into a find as $var[1] and $var[2] I get Active[1] and Active[2] as the strings inserted into the target fields. However, If I throw up a dialog box with $var[1] and $var[2] in the title or body, they parse out just fine to their respective values. I can't find any documentation on how variables with repetitions are supported in scripted finds. From what I can see, they aren't. I know I could just rewrite the variable names to different values but I like the tidyness of repetition references. Anyone have the same sort of experience on the topic? Thanks
February 20, 201510 yr It should work fine. But what do your scripted finds look like? Can you post a copy of your script? Are you using the format: Enter Find Mode[] Set field... Perform Find[]
February 20, 201510 yr Instead of using a stored find, write Enter Find Mode Set Field [ YourTable::yourField ; $varName [ repetition ] ] Perform Find [ no restore ]
February 20, 201510 yr Author Thanks for the quick reply. Here are some screenshots to better illustrate the scenario. Results in..... The Set Field function also parses out repeating variables correctly. But, I'm on a kick to economize my script steps and having 4 or 5 steps to enter find mode, set fields and perform the find is a lot more work than Perform Find with restored option. So, I was hoping to cut down work. It's looking more and more like that may not happen. Thanks again.
February 20, 201510 yr Just do as EOS mentions. There is no gain in economizing script steps. Things will not be faster. And your code will be more transparent and easier to maintain. Any potential benefit you think you could have is already gone by trying to make it work any other way... But, I'm on a kick to economize my script steps Just to be very clear: that is a noble undertaking but there are many places where it does not pay off. This is one of them.
February 20, 201510 yr I can't find any documentation on how variables with repetitions are supported in scripted finds. From what I can see, they aren't. Actually, this is covered in the Help, although in a somewhat sloppy way (so what else is new?): A variable in a find request cannot include the repetition (index) number of a repeating field (as in the syntax $variable[repetition]) or a file path. http://www.filemaker.com/help/13/fmp/en/html/non_toc.46.45.html#1029788
February 20, 201510 yr Author Well son-of-a-gun. There it is. Missed that reference in all the reading I did on the subject. Thanks for pointing it out, comment!
Create an account or sign in to comment