Jump to content

Using variables with repetitions in scripted finds


Hijack

This topic is 3346 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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[]

Link to comment
Share on other sites

Thanks for the quick reply.  Here are some screenshots to better illustrate the scenario.

 

image1.jpg

 

Results in.....

 

image2.jpg

 

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This topic is 3346 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.