Is there a more efficient way to call one of a number of scripts than hard coding a bunch of if/then "if the dropdown list choice is X, run X script, y run y script, etc" triggered on field modification, or is that the best way to do it?
There is not a "perform script by calculated name" feature, so there's really not another way.
I think someone once theorized you could cobble together the "perform script by calculated name" functionality using the fmp:// protocol and a calculated string, but there's issues with the way that's executed as well.
I wish there was. I have an idea for a menu which would actually be a portal in popover but I have the same problem i would need a bunch of if then statements.
It doesn't make any sense that one can't put script names in a dropdown list to select them....but that's the reality?
If you think about what the drop down feature is, then yes, it actually does make sense.
You CAN do it, at least from the perspective of your users, you just need to code the backend processing of the trigger as you've noted.
Why not create a single looping script which includes your conditions? Thus:
If [ choiceField = "x" ]
Perform Script [ x ]
Else If [ choiceField = "y" ]
Perform Script [ y ]
This way you can call this script by whatever means (script trigger, button, etc) you want to use and the script itself will then call the appropriate sub script.
I thought that's what he was already doing. He was complaining about the manual need to setup the If/Else If/etc../End If as you've noted.
Retrieving data ...