7 Replies Latest reply on May 16, 2012 8:33 AM by PatriciaSamuelsen

    "Optional Script Parameter" Possibility?

    ebthatsme

      Title

      "Optional Script Parameter" Possibility?

      Post

      I have a series of buttons on a page that I basically want to all use the same script ... with a slight change. Was thinking that I could make use of the optional script parameter option when I choose the script in the button setup window ... but I'm doing something wrong b/c it's not working. Also, my understanding of the script parameter option is shaky at best so I could be missing something very simple. Any suggestions or ideas would be greatly appreciated.

        • 1. Re: "Optional Script Parameter" Possibility?
          raybaudi

          Try using this simple script:

          Show Custom Dialog [ Get ( ScriptParameter ) ]

          attached to all your buttons ( which have unique numbers into their space for the Script Parameter )

          • 2. Re: "Optional Script Parameter" Possibility?
            ebthatsme

            Thanks for the info, RayBaudi.

            My error ... issue not as thoroughly explained as I should have. Sorry. What I'm trying to do is have each button choose the exact same script ... with the exception that I'd like to use a different optional script parameter for each button. And what I'd like that script parameter to be is a specific record (called via a keyID) in another table available within the same database. However, it's not a related table. Don't know if this explains it any better. 

            Also, I've never used "Show Custom Dialog" so don't know quite what to do with either of the windows of info they want me to provide. And, I don't want the user to provide the info - I want to do it.

            Quite possibly I'm going about this all the wrong way. While I've been using FM for many years, I'm self taught so have numerous gaps in my understanding. 

            Appreciate your help.

            • 3. Re: "Optional Script Parameter" Possibility?
              philmodjunk

              Show custom dialog with the expression Raybaudi posted is a simple test step to see if your script got the correct value passed as the script parameter.

              And what I'd like that script parameter to be is a specific record (called via a keyID) in another table available within the same database. However, it's not a related table.

              That seems a bit contradictory. If it's not in a related table, how do you know which keyID is the correct keyID for the record in question for each such button clicked?

              You can't pass the actual record as a script parameter but your buttons can pass different values in the script parameter to serve as the keyID. Is that what you are tying to do?

              How exactly is this not working for you?

              • 4. Re: "Optional Script Parameter" Possibility?
                ebthatsme

                Show custom dialog with the expression Raybaudi posted is a simple test step to see if your script got the correct value passed as the script parameter.

                Ahh - got it, sorry. Went back and tried it and it did pass the value I'd entered. So, now I want to use that value to be used to locate a specific record in the other table. 

                That seems a bit contradictory. If it's not in a related table, how do you know which keyID is the correct keyID for the record in question for each such button clicked?

                I know the keyID because I'm going back and finding the specific record that's needed. I want each button to call a specific document/website. In this case, relational didn't seem necessary but maybe it is the best way to go. 

                You can't pass the actual record as a script parameter but your buttons can pass different values in the script parameter to serve as the keyID. Is that what you are tying to do?

                Yes, basically, I want the script parameter info to serve as find criteria. Can I do that? Can I call script parameter info in a perform find?

                These are probably very "duh" questions but as I said, I know I have some major gaps in my understanding. 

                Hope this explains things better and I appreciate your patience and your advice.

                • 5. Re: "Optional Script Parameter" Possibility?
                  philmodjunk

                  Use the Get ( ScriptParameter ) function.

                  Go To Layout[select layout of table you want to search]
                  Enter Find Mode[]
                  Set Field [YourTable::YourFIeld ; Get ( ScriptParameter )]
                  Set Error Capture [on]
                  Perform Find []

                  • 6. Re: "Optional Script Parameter" Possibility?
                    ebthatsme

                    That did it! 

                    I've never used that function before - one of my gaps in learning! Thanks for the help. I really appreciate it.

                    • 7. Re: "Optional Script Parameter" Possibility?
                      PatriciaSamuelsen

                      I have an issue very similar to this, but I would like to use the same button and pass a field name as the optional script parameter.  I want to use the value in that field as the search value in my find command.  Is that possible?

                       

                      In other words I want to use the value of the "ClassID" field in my current table to search for all the enrollment records in another table for that class.  But I want to use the same script for each class. 

                       

                      Thanks.