8 Replies Latest reply on Jul 23, 2010 11:10 AM by philmodjunk

    Script Issue



      Script Issue


      Hello all!

      Being very new to FM 9, I have taught myself scripts, even managing to get one to pause, waiting for user input.  However, I want to go one step further and have not been able to get it to work.  I am using ScriptMaker because I am not a very good programmer. 

      I have a table of referral information - one of my fields is Customer No.  I want the user to be able to input which customer number they are searching for.  However, when I try to add the custom dialog box to the script, I get the error:  There are no valid criteria in this request.  Type a valid request before clicking Find.  Here's my script:

      Go to Layout (I specified the layout "Customers" in the "Specify" box)

      Show Custom Dialog (In the Options, on the General Tab, I put "What is the Customer Number?" in the Message box.  I then went to the Input Field tab and specified that I wanted it to Show input field #1, "Customers"

      Perform Find[]

      Can anyone tell me what I am doing wrong?  All the books, posts, webpages I can find just don't spell it out clearly enough for this newbie. 

      Thank you in advance!


        • 1. Re: Script Issue

          Try it this way.

          Define a global field, gCustomerNo. To define a global field, open its field options and click the storage tab to change it to global storage.

          Now change your script to be:

          Go to Layout
          Show Custom Dialog [//specify gCustomerNo as the input field]
          Enter find mode[] //clear the pause checkbox
          set field [Yourtable::CustomerNoField ; YourTable::gCustomerNo]
          Set Error Capture [on] // keeps the no records found dialog from popping up in the middle of your script
          Perform Find[]

          • 2. Re: Script Issue

            Howdy NewUser,

            I don't know if it was an oversight in your script, or an oversight in your post above...but you never entered Find Mode.

            Put the step "Enter Find Mode" just prior to the Show Custom Dialog.

            • 3. Re: Script Issue


              Thanks for noticing.  I had just omitted it when retyping for the post.

              • 4. Re: Script Issue


                Of course, your solution worked perfectly.  You are awesome and saved me "again".  Can you please explain why I had to build a new field instead of using my current one?

                • 5. Re: Script Issue

                  Ninja's suggestion does work. I just tested a script to be sure as I don't normally use custom dialogs with scripted finds:

                  Enter Find Mode [ ]
                  Show Custom Dialog [ Title: "enter a value"; Buttons: “OK”; Input #1: CustomDialogFindExp::field, "a fruit please:" ]
                  Perform Find [ ]

                  worked just fine in my test.

                  • 6. Re: Script Issue

                    Yes, it did work.  I had to change the way I had my custom dialog set up; but, it finally worked. 

                    Thank you both so much!  I am moving to a new position within the company next week and am trying to "dummy proof" the database a little more before leaving it in someone else's hands.

                    Have a GREAT evening!

                    • 7. Re: Script Issue

                      As odd as it may seem  ;)  the use of custom dialog inside a search script is given as an example of how to use the custom dialog feature in the on-board help in FMP8.  Dunno if it is still there in later versions.

                      • 8. Re: Script Issue

                        My only beef with using Show Custom Dialog for is that its input fields are too limited. Validation has to take place after the dialog is dismissed and you can't format the input field with a value list, or other control. As a result, I usually use either the new window command with all its quirks to pop up a small floating window or switch to a dedicated search layout.

                        I reserve a custom dialog with an input field for just a few uses where the input is simple text only.