5 Replies Latest reply on Mar 11, 2015 12:25 PM by dsimonson

    Popover question



      Popover question


      Here is what I want to do:  on an iPad, when the user taps on a specific area (in this case, the anesthesia gases area), I want a popover to show that will allow them to enter an observation - basically, to enter or change the parameters of a particular anesthetic gas.  

      The problem is that this requires that before the popover presents itself (OnObjectEnter?), I need a script trigger to run that 

      1.  goes over to the OBS_GASES table layout

      2.  checks to see if there was a previous record entered for that fk_surgery_id

      3.  If there is, duplicates it (to allow for simpler data entry)

      4.  If not, creates a new one with the current time in the time_obs_gas field

      5.  Returns to the original layout and popover, and presents the fields from the new or duplicated record in the popover for the user to fill in 

      6.  Exits the script


      Here is what I have now that doesn’t work.  Note that I am trying to make sure I don’t get an endless loop by setting a $$EXIT at the beginning (I read a post about how to use this and OnObjectExit), I am also utterly confused how to make that work.  


      Trigger - Enter Gas Observation (runs on entering the popover)

      If [ $$EXIT = "True" ] 

      Exit Script [ ] 

      End If 

      Set Variable [ $$EXIT; Value:0 ] 

      Perform Script [ “Allow User Abort” ] 

      Perform Script [ “Set Error Capture” ] 

      Set Variable [ $SurgeryID; Value:SURGERIES::_pk_surgery_id ] 

      Go to Layout [ “Enter Gases - Landscape” (surgeries_OBS_GASES) ] 

      Go to Record/Request/Page [ Last ]

      If [ surgeries_OBS_GASES::_fk_surgery_id= $SurgeryID ] 

      Duplicate Record/Request Else 

      New Record/Request 

      Set Field [ surgeries_OBS_GASES::_fk_surgery_id; $SurgeryID ] End If 

      Go to Layout [ “Anesthesia Record” (SURGERIES) ] Go to Object [ Object Name: "Popover - Enter Gases" ] 


      Here is my endless-loop prevention script:

      Script Triggers: Trigger - Enter Gas Observation Exit 

      If [ $$EXIT=0 ] 

      Set Variable [ $$EXIT; Value:"True" ] 

      Exit Script [ Result: 0 ] 

      End If 


      Dan Simonson, CRNA, MHPA
      2607 S. Manito Blvd.
      Spokane, WA 99203

      H. (509) 747-0819
      C. (509) 981-6274 


        • 1. Re: Popover question

          What exactly do you mean by "doesn't work"?

          Did you set this trigger on the popover button or the popover panel? This should be a trigger set on the panel, not the button.

          • 2. Re: Popover question

            Sorry - by "doesn't work" I meant that I got caught in an endless loop.  

            But now I have another problem - per your suggestion,I have assigned the scripts above to trigger with "OnObjectEnter" on the popover panel - but now when I click on the panel, the scripts don't execute!  The popover shows up without triggering the enter script, presenting me with the data from the first "surgeries_OBS_GASES record, which I can modify, and when I click outside to exit the popover, the popover goes away without executing the OnObjectExit script.  I have the Script Debugger and Data Viewer open, but nothing happens to them.  

            I tried a number of things, recreated the popover, quit and re-started FileMaker, etc., but still no joy.  Any idea why the scripts aren't executing?  Thanks, Phil.


            • 3. Re: Popover question

              Ok, I have continued looking (I don't want you to think I'm lazy!) and I found this:


              It says, "Clicking a button, a popover button, or a panel control does not activate this trigger on the button or tab."

              Ok, so any ideas on how to get a script to do a bunch of prep work in the background before the popover is presented?   

              • 4. Re: Popover question

                Clicking a popover button does not trip a trigger on the button. But I have recommended that you set up the onObjectEnter trigger on the Panel that the button opens.

                I often use this method on popovers that I now use in place of new windows or custom dialogs for users to specify search criteria in global fields. The script trigger performs a script that clears the global fields so that the users "starts fresh" with each use of the popover. Thus, I know that this works.

                • 5. Re: Popover question

                  I took your hint about global fields.  What I am doing now, and it makes it a _lot_ simpler, is just placing global fields on the popover and then doing all the work using "OnObjectExit".  Working good!