7 Replies Latest reply on Nov 5, 2016 8:36 PM by TKnTexas

    what is Script parameter ?

    aliabbassipro

      hi ! when we used script parameter Usually؟

        • 1. Re: what is Script parameter ?
          beverly

          See this help topic for example usage of Script Parameter:

           

          Sent from miPhone

          • 2. Re: what is Script parameter ?
            aliabbassipro

            thanks , but now i want just kbow about script parameter and learning videos on youtube & blogs is very bad

            • 3. Re: what is Script parameter ?
              keywords

              Whenever you are specifying a script to perform, you have the option of specifying a script parameter. This is information which you pass to the script and can use within the script itself; the parameter could be a piece of text, a number, or a calculation, for example.

              A typical use case would be a script that could be used in more than one way, e.g. to navigate to the previous record or the next record. You could specify a script parameter on one button as "back" and on another button as "forward", assign the same script to each button, and then the script will navigate accordingly. Perhaps that simple example will give you some idea.

              • 4. Re: what is Script parameter ?
                David Moyer

                Hi,

                here's a simple example of sending and receiving script parameters ...

                Capture.PNG

                Capture.PNG

                • 5. Re: what is Script parameter ?
                  fmpdude

                  One cause of confusion is that FMP only allows "one" script parameter. Thus, if you have a script where you'd like to pass more than one value, you need to resort to "special tricks". That's a bad design in my view which should have been remedied many versions ago.

                   

                  On to your question ... Just think of a script as a regular function (like in JavaScript) which accepts parameters. If you don't understand functions and parameters, it's time to spend a bit of time researching functions and passing parameters or maybe take a class at a community college. This is a critical concept to understand in any kind of programming in any language...anywhere.  But, basically, in FMP, you're just "sending" a (single) value to the script to work with.

                   

                  In real programming languages you can pass very complicated types (both literal and reference) to a function/method, but, fortunately in FMP, you don't need to worry about that distinction. FMP makes life as easy as possible.

                   

                  HOPE THIS HELPS.

                  • 6. Re: what is Script parameter ?
                    robear

                    here is another simple use of script parameters

                     

                    say you have 2 buttons on a layout, 1 to print the layout and the other to Preview the layout

                    both buttons will run the same script "print/preview report"

                    - for the print button, when you choose the script to run, you add "Print" to the optional script parameter field at the bottom of the "Specify Script" dialog window

                    - for the preview button, when you choose the script to run, you add "Preview" to the optional script parameter field at the bottom of the "Specify Script" dialog window

                     

                    Now when you write the script "print/preview report",

                    - you add an IF to the script that allows you to choose between print or preview

                    - the script will run one button or the other,

                      - if the script is run without the parameter (nothing will happen)

                     

                    allow User Abort [off]

                     

                    if (get script parameter = "Print")

                      go to report layout

                      print

                    end if

                     

                    if (get script parameter = "Preview")

                      go to report layout

                      enter preview mode

                    end if

                     

                    go to [original layout]

                    • 7. Re: what is Script parameter ?
                      TKnTexas

                      Thanks for a very good explanation.  I have also been a little confused on script parameters.