14 Replies Latest reply on Dec 28, 2015 8:27 AM by BruceRobertson

    Popover not displaying

    sharpie

      I've been getting some very strange behaviour with my popover button that I've never seen before.  I created a popover button on an invoice layout to perform a script to convert the invoice total price from GBP to Euros, store the converted price in a variable and display it in a merge variable on the popover.  The button runs the script that is set to run from the popover's 'OnObjectEnter' script trigger, but it doesn't display the actual popover window which is a bit of a problem because that's where the result is displayed to the user.  I don't get it.  I thought it might be because I created the layout as a print layout from the wizard.. So what I did was create another layout in the same context but told the FileMaker wizard that it was a computer layout , actually that still didn't solve the problem.  I then copied the exact same object to my original layout based on the same TO and it does display the popover and perform the script.

       

      ...So it's very weird, my popover object is only popping over/ displaying on one layout and not others (in particular not on the layout that I want it to).  Does anybody know why this might be?  Had this problem before.

       

       

      I hope you can help.

       

       

      Thanks

      Sharpie

        • 1. Re: Popover not displaying
          schamblee

          OnObjectEnter only triggers when a user enter that object. 

           

          It appears to me that you don't need a script trigger or a script.   Put the formula to covert from GBP to Euros in a calculation field, place this calculation field in the popover then when the user clicks the popover the amount will display. 

          If you want the popover to automatically open then you would use a script trigger onObjectModified, name the Calculation field in the popover then use go to object by name.

          • 2. Re: Popover not displaying
            BruceRobertson

            sharpie wrote:

             

            ..So it's very weird, my popover object is only popping over/ displaying on one layout and not others (in particular not on the layout that I want it to).  Does anybody know why this might be?  Had this problem before.

            It would probably be helpful if you attached a copy of your file or a simplified file that demonstrates your approach.

            I doubt that anything at all weird is going on. Your script is doing exactly what you asked it to do.

            Rather, this is an issue of understanding in detail what is happening. Thus we also need meaningful, valid detail about what you are doing. Right now we don't know what your script does and we do not know EXACTLY which object it is attached to.

            • 3. Re: Popover not displaying
              sharpie

              BruceRobertson I've uploaded a simplified version of my file ConvertCurrency_popoverTest.fmp12 which demonstrates what I'm trying to do.  schamblee, I thought about having a field, but for the purpose a merge variable to display is better.  In reality the company wouldn't be able to make a Euro invoice to the customer, as it's not something that we do, but ocassionally we get asked for the Euro amount so that a customer knows how much to transfer, (although we prefer the sterling amount be transferred, this rule can be waived at management discretion, depending on circumstances etc) this would give us a quick way to get that info. from within the solution.  Also an exercise in the FTS Advanced uses this same approach of a popover to display the data in a merge variable , and I copied that approach of having an onobjectenter trigger to trigger the conversion script on the popover , and at least the popover appears, although I suppose mine's a bit of a simplified version.

               

               

              Today the popover doesn't even appear on my original layout , I must have changed something in playing around with it to affect this :-?

              • 4. Re: Popover not displaying
                schamblee

                It will work the same with a merge field.

                 

                Click your merge field, then go to the inspector, click the position tab, Enter a name in this box to name the object.   You will then use Go to object [Name] in your script.

                • 5. Re: Popover not displaying
                  schamblee

                  I downloaded your sample file. Your files has a few issues.    I'm only going to deal with the pop over displaying.   You are using the wrong script trigger and you are using a local variable instead of a global variable.

                   

                  Remove the script trigger from the popover setup.

                  Right click the Euro button then select script trigger, then select onObjectEnter, then select your script.

                  Change the $newAmount Variable to $$newAmount.  This will need to be changed in your script and in your popover.

                  • 6. Re: Popover not displaying
                    BruceRobertson

                    Your script is doing what you told it to do:

                    Upon entering the pop, immediately LEAVE the popup and go to the api_result field.

                    Also, since the value is stored in a script variable, and the script ends, the variable is now empty.

                    • 7. Re: Popover not displaying
                      szeigen

                      Possible resolution to problem first discussed!

                       

                      Use go to field instead. Place a field on the popover than is not used any where else on your layout, even on other tabs. Fill this field (TEMP_NUM_CONVERSION) that go to this field and viola  .. the popover appears!

                       

                      I had the exact same issue when trying to script a popover to open using a go to object script step ... no good. I have a custom menu item Find Patient (ctrl-F). When initiated it goes to the only element on the screen with the field I am using for the patient search, "CHART_FIND", a global number.

                       

                      This work every  time but does require a dedicated global field!

                      • 8. Re: Popover not displaying
                        schamblee

                        Go to Object will work.  You have to name the object before you can use go to object.   Go to object works with fields or other objects on the layout.

                         

                        Go to Field works with Fields only.

                        • 9. Re: Popover not displaying
                          BruceRobertson

                          So here is one mod.

                          As mentioned by schamblee, $newAmount needs to be turned into a global variable $$newAmount so that it will persist.

                          Then, optionally, an onObjectExit script can clear the variable when the popup closes.

                           

                          The other problem was that the insert from URL field immediately closed the popover because it moved the focus to the api_result field which was on the body of the layout.

                           

                          So one possible solution to this part of the problem (as demonstrated here) is to put the api_result field on the popover. In this example, it is set to hide always.

                          • 10. Re: Popover not displaying
                            sharpie

                            Thank you @BruceRobertson .  I see, that's been very helpful.

                             

                             

                            FTS Advanced file appeared to have it working the way that I was trying to make it work.  It looks like the difference is, in the FTS Advanced example, insert from URL is inserting the 'api call result' into a field in another table (and that field does not appear on the layout with the popover and attached script), so object focus was not actually moving; moving field focus is not an issue in that file, therefore the popover remains open in the FTS Advanced file.

                             

                            I have moved the 'apiCallResult' field on to my popover now as you suggested, and used the onobjectexit script trigger to clear the variable.  It's functioning as expected now.

                             

                            @BruceRobertson I could see your file only in Browse mode, I couldn't see in layout mode how you had changed the file.  I worked it all out from your description , I just wondered whether you meant to send the file in that restricted access state (not modifiable)?

                             

                             

                            Thank you to everyone else for your input: Schamblee and Szeigen.

                            • 11. Re: Popover not displaying
                              sharpie

                              Whoops, Sorry BruceRobertson.  It's my fault, I think I didn't download it properly the first time to be able to modify the file etc , I've got it full access now

                              • 12. Re: Popover not displaying
                                mbk28

                                Hello,

                                 

                                who know a complete tuto for popover to search and create a people is the result is null

                                Thanks in advance

                                • 13. Re: Popover not displaying
                                  schamblee

                                  Sorry, I don't understand the question.

                                  • 14. Re: Popover not displaying
                                    BruceRobertson

                                    Strart a new discussion for that question.