4 Replies Latest reply on Nov 25, 2016 11:29 AM by corkhia

    Multiple Script Parameters/Results including Lists

    corkhia

      I want to be able to pass a combination of different parameters, including lists embedded within some of those parameters, and then expand them on the receiving script.

       

      My specific use is passing essentially arrays of data to populate charts with values and labels together with say some single values for things like a title.  I have 30+ different (user selected) combinations of data that I am sending to a single chart display, and wanted to modularize it to reduce the degree of clutter and repetition that my scripting currently has in it.  I realize that I could post each list as a global variable and access it that way, but have resisted going down this route to date.

       

      From my experimentation so far, passing more than a single list of data in a parameter doesn't seem to work.  I have looked at the interesting work done on Modular Filemaker with name/value pairs and arrays, but this does not appear to solve this particular issue either (unless I am missing something obvious).

       

       

      I would appreciate any guidance or ideas that you smart Filemaker people might have be able to give me.

       

      Thanks

       

      Alan

        • 1. Re: Multiple Script Parameters/Results including Lists
          philmodjunk

          You can pass more than one list as a list of values, but only if you have some kind of delimiting value so that you can tell where one list starts and the other ends:

           

          List ( List ( "Value1" ; "Value2" ; "Value3"....) ; "xxxxxDelimitterxxxxxx" ; List ( "Valuea" ; "valueb" ; ... ) )

           

          Your then parse your list of values back into two lists by using either a looping script or a recursive custom function that searches for that delimitter text in order to know where to stop parsing values for the first list and start parsing values for the second.

           

          There is also a different way to pass multiple values as a script parameter or result:

           

          "Let ( [ $List1 = " & substitute ( List ( "value1" ; "value2" ; ....) ; ¶ ; "; " ) & " ; " &

                      "$List2 = " & substitute ( List ( "valuea" ; "valueb" ; ....) ; ¶ ; "; " ) & "] ; 1 ) "

           

          Inside your script, you get your lists with a script step like this:

           

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

           

          When this step is performed, two script variables, $List1 and $List2 are created and a list of values are assigned to them. This second option is a lot more complex and takes a lot more time to work with, but can be a better option in some cases when the values needed to be passed might be null in some cases, for example.

          1 of 1 people found this helpful
          • 3. Re: Multiple Script Parameters/Results including Lists
            erolst

            philmodjunk wrote:

            [...] if you have some kind of delimiting value so that you can tell where one list starts and the other ends:

             

            List ( List ( "Value1" ; "Value2" ; "Value3"....) ; "xxxxxDelimitterxxxxxx" ; List ( "Valuea" ; "valueb" ; ... ) ).

            Where it is a good idea to think of a delimiter string that will not appear "in the wild", then create a Custom Function to define it as a constant.

            • 4. Re: Multiple Script Parameters/Results including Lists
              corkhia

              Awesome! I love the way so many brilliant minds come together to help with solutions on this platform.

               

              I will put the second of your suggestions into effect as this is definitely in keeping with the way I like to process information.

               

              Thanks again.  Alan