5 Replies Latest reply on Oct 8, 2014 2:24 PM by scotthoffman

    Sending Global Variables through scriptparams?



      Sending Global Variables through scriptparams?


      I'm having a hard time with sending multiple variables through a script parameter then getting those parameters from a Script running on the server.


      The User chooses multiple options in the layout which in-turn becomes $$variables -(Job number=$$jobnumber, Station=$$station, etc)I then want to perform a script on the server which takes these variables and creates a record in a different table and inserts these variable in the fields.

      Im trying to get the server to perform these tasks as there are about 20 employees consistenlty creating and editing these records on ipads and i want to speed up the time on them.


      Any help or alternate suggestions would be appreciated.




      I've tried adding a script parameter - List ($$jobnumer;$$customer)

      then trying to Grab it in the Server script with Set Variable [$$jobnumber; Value:GetValue(get(sciptparameter); 1)]

      That does not work..

        • 1. Re: Sending Global Variables through scriptparams?

          I see no need for the variables to be global variables in your example not that using them should keep this from working.

          Using: List ( $variable1 ; $Variable2 ) as your script parameter should work provided that $Variable1 is not empty. If it's empty, then GetValue( Get (ScriptParameter ) ; 1 ) returns the value of $Variable2.

          Might that be why it failed?

          There is another option that is more complex that will work even when some of the values passed might be null:

          Here's an example script parameter from one of my working DB's:

          "Let ( [ $Message = " & Quote ( "Tags with Nonferrous metal must have an address." ) & " ; $WindowName = " & Quote ( "ERROR" )  & " ; $ButtonList = " & Quote ( "OK" ) & " ] ; 1 )"

          In the script that receives this script parameter, I use:

          Set Variable [$Dummy ; Evaluate ( Get ( ScriptParameter ) ) ]

          The Let function passed as text in the script parameter is what assigns values to the $Message, $WindowName and $ButtonList variables here. The value 1 is assigned to $Dummy and is then ignored by my script.

          Caulkins Consulting, Home of Adventures In FileMaking

          • 2. Re: Sending Global Variables through scriptparams?

            That might be why..

            to Get around the empty variable Could i use an If ( isempty ($$jobnumber);" "; $$jobnumber) ? 

            • 3. Re: Sending Global Variables through scriptparams?

              To get around the empty variable, which results in List "sliding the value to the left" to close up the gaps caused by the null values, use the second method that I've described here, or make sure that a harmless non-null value is assigned to the variable.

              I've sometimes used:

              List ( $Variable + 0 ; $variable2 & " " ; $Variable3 )

              You don't have to do anything extra with the last value so you can sometimes just make the last value in the list your "sometimes null" value.

              And you don't have to use variables in this expression. The listed terms can directly reference fields instead.

              • 4. Re: Sending Global Variables through scriptparams?

                Putting in those spaces is what did it..Was not aware of the sliding left issue.. Thanks for the help

                • 5. Re: Sending Global Variables through scriptparams?

                  I just wanted to reply to this...I found a solution to the empty variable shifting when using script parameters. Instead of adding $variable & " " you can use if(isempty($variable);" ";$variable) so instead of adding a &" " to everything, you just add to the empty fields.