Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 5602 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi

I have a series of 50 objects (not fields) on a layout. I want to format each as a button to run the same script with the exception of one variable. That variable happens to be 1 through to 50.

So I named each object 1 through to 50 and used

GetAsNumber (Get (ActiveLayoutObjectName) )

to set a variable, hoping to get the number I wanted into the script. It only returned a "?".

Reading related threads (Post#271689, topic id 189716) I noticed someone advised that an object is only active if the cursor is in it, so if this is the case the object would have to be a field and entered to return the object name?

Is there an easier way without having 50 almost identical scripts?

Posted

As you've found, you can't use Get (ActiveLayoutObjectName) for buttons that way. What you can do is pass the numbers as a ScriptParameter of each button.

Posted

Thanks. I've read the FM help on Get(ScriptParameter) function. I've never used Let, Evaluate or Get(ScriptParameter) before and I'm not sure where to start here. Can either of you pls give an example of how to make each button use a different number in the script?

Posted

So your script starts with something like:

Set Variable [ $var ; Value: GetAsNumber ( Get ( ActiveLayoutObjectName ) ) ]

Instead of having the $var with a number from 1 to 50 ( not possible in your way ), you'll use the Script Parameter.

To do so, you do not need to name each object, but to give different numbers ( from 1 to 50 ) into the place for the script parameter that you can see when apply your script to each object.

The value that you'll insert will be passed to the script and retrived with the Get ( ScriptParameter ) function.

This topic is 5602 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.