Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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

Posted

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.

Posted

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 :)

Posted

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

Posted

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.

Posted

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.

This topic is 6642 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.