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.
..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.
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 :-?
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.
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.
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.
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!
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.
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.
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.
who know a complete tuto for popover to search and create a people is the result is null
Thanks in advance
Sorry, I don't understand the question.
Strart a new discussion for that question.