Skip 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.

passing multiple values in Script Parameter

Featured Replies

I've created a variable in one script:

Messages::applicant_FirstName_ae&"¶"&

Messages::applicant_Middle&"¶"&

Messages::applicant_LastName_ae&"¶"&

Messages::Search&"¶"&

Messages::Male_Female_ae


and am trying to pass it as a ScriptParameter to a script in a related external file.. by entering $script_values in the ScriptParameter box.



Then, in the script in the other file's script, I'm trying to retrieve the values (minus their carriage return)... and somehow I'm ending up with field values that are only the first two characters.



So,  "Johnson" is coming over as "Jo"



The way I'm trying to retrieve the values in the script is:




Left(MiddleValues(Get(ScriptParameter); 1;1 ); Length((MiddleValues(Get(ScriptParameter); 1;1 )) - 1))

Am I doing something wrong ??

thanks,

:) beta

FileMaker 8 has a much easier method: GetValue ( listOfValues ; valueNumber ).

I would first set a variable to the script parameter, just to make it easier to read as I go:

Set Variable( $var; Get ( ScriptParameter ) )

and then:

Set Variable( $first; GetValue ( $var ; 1 ) )

Set Variable( $middle; GetValue ( $var ; 2 ) )

Set Variable( $last; GetValue ( $var ; 3 ) )

etc.

This method has one serious limitation: if one of the fields you're passing in the script parameter has carriage returns within it, then each paragraph of that field will become a value. If only one of the fields has returns, make it the last value in the script parameter; then you can use GetValue for all the preceding values, and for the final one, use:

Let( [ len = Length( $var ) ;

start = Position ( $var ; ¶ ; 1 ; 3 ) ;

num = len - start ] ;

Right( $var ; num ) )

The number 3 in this calc is the number of values that precede the final one.

If you have more than one field with carriage returns, you're probably better off using a different technique.

  • Author

Thank you so much for this.

I have a follow-up question..

In a similar way, I'd like to pass a script parameter that has a varying amount of values in it.

How can the script I pass this parameter to loop through the values until there are no more values to deal with ??

thx :)

Hi Steven,

You seem to be passing information (addresses?) through your variables and, although you may have good reason, there are usually easier/better ways. For instance, a single workhorse global can relate to many files xor tables simultaneously and you can orchestrate some beautiful script-music, making and breaking those relationships. Sometimes I feel like a conductor when I script. And this entire process can be handled all within your ONE file's graph. I'm not saying variables can't be used for addresses; only that passing a full address (or any large data-chunks) USUALLY isn't required. If you would like to explore that further, please let us know.

Here's the thing ... data should flow (through relationships) and not be passed around. Usually. :wink2:

LaRetta

Again let's presume that your values don't contain carriage returns, i.e., each line of the script parameter is a value.

Set Variable( $var; Get ( ScriptParameter ) )

Set Variable( $values; ValueCount($var) )

Set Variable( $counter; 1 )



Loop

 Set Variable( $x ; GetValue ( $var ; $counter ) )



 // do something with $x, e.g. put it into a repetition:

 Set Variable( $y[$counter]; $x )



 Set Variable( $counter; $counter + 1 )

 Exit Loop If( $counter > $values )

End Loop

I kind of agree with LaRetta, but I know there are always exceptions. What I don't really get in this case is what you want to do with this unspecified number of parameters. How are you going to determine what to do with parameter x unless you know what x "means?" That's why I think you should look at the link I posted above (click the word "technique") or keep digging.

Something else to consider is this:

http://edoshin.skeletonkey.com/2006/02/options.html#more

--sd

  • Author

The reason I wanted to pass such parameters is because I'm using the mail.it plugin in one database.. and want to pass the paths of "x" number of files to another filemaker file that will reference those files.

I'd really not check email directly into the main filemaker database that i'm passing the references to.. so, I was thinking it might be nice to just pass a script paramater of a list of path/values in a portal to the main database to make them accessible from the main database.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.