3 Replies Latest reply on May 28, 2009 10:50 AM by TSGal

    Scripting for IWP: failed finds



      Scripting for IWP: failed finds


      I'm sharing my database with a few users via Instant Web Publishing (IWP), and I am allowing them to perform finds on the records in that file.  The users are accessing the database file via a web browser.  I want to write a script that will perform a find on the fields specified by the user, then do one of two things:


      1. if the find results in a nonempty found set, sorts the records and displays them in browse mode
      2. if the find results in an empty found set, returns the user to browse mode with no record displayed. 
      Currently, the script works if the found set is nonempty.  However, if the found set is empty, a dialog box appears alerting the user.  When the "OK" button is clicked (the only button displayed), then the user is returned to find mode.  Clicking "Continue" on the left-hand menu bar does not continue the script; it refreshes the page in find mode.  I've tried using the get(LastError) and get(windowmode) functions, but the former is incompatible with IWP and the latter is never executed.
      Any suggestions on how I would accomplish this? 


        • 1. Re: Scripting for IWP: failed finds

          My projects haven't required IWP, so I could be wrong here, but...


          Do you see the same dialog when you run the script just with filemaker?


          If so, you can use set error capture to keep the dialog from appearing.


          Set Error Capture [on]

          Perform Find []

          Set Error Capture [off]


          That approach suppresses the dialog box in regular filemaker. It may work for you in IWP as well.

          • 2. Re: Scripting for IWP: failed finds

            The interface via a web browser (IWP) is quite different than the client interface in FileMaker 10 Pro.  The Set Error Capture function is not compatible with IWP, unfortunately.  That was my first thought, too.  It will work in the client interface, but not IWP.


            The dialog that appears in the client interface shows three buttons: "Modify Find," "Continue," and "Cancel."  In the IWP interface, there is only one button, "OK," which has the same effect as "Modify Find" in the client interface. 

            • 3. Re: Scripting for IWP: failed finds



              Thank you for your post.


              Yes, Set Error Capture is compatible with Instant Web Publishing.  However, the Find icon (magnifying glass) in Instant Web Publishing does not use any of the script controls.  Instead, you would have to create your own buttons to activate the Find.  For example, create an additional global field for the field you are trying to search.  Assuming you are searching an ID field, create g_ID.  Then, have a Find Layout that allows you to import information into the field and press a button that activates a script to execute the Find.  To be more specific, the script may look like:


              Set Error Capture [On]

              Go to Layout [ <layout where you want to search> ]

              Enter Find Mode []

              Set Field [ ID ; g_ID ]

              Perform Find []

              If [ Get ( FoundCount ) = 0 ]

                 Set Field [ g_ID = "" ]

                 Go to Layout [ <return to Find layout> ]

              End If

              Set Field [ g_ID = "" ]




              This allows you to switch to the layout you want to search, go into Find mode, put the information from the global field into the regular field and perform the find.  If no records are found, then you are returned to the original Find layout (and resets the global field to blank).  Otherwise, your records are found and displayed, and I reset the global field back to blank, so if I go back to search again, there is no value listed.



              FileMaker, Inc.