Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Using variables with repetitions in scripted finds

Featured Replies

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

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

Instead of using a stored find, write

Enter Find Mode
Set Field  [ YourTable::yourField ; $varName [ repetition ] ]
Perform Find [ no restore ]
  • Author

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.

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.

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

  • 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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.