Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I am trying to create a script to go to a specific field depending on the script parameter assigned to a button. But the go to field (or set field) steps do not give me a calculation possibility to choose the parameter. Any suggestion?

Posted

Use the Get ( ScriptParameter) to control your script and direct it to the appropriate field.

If you're using this as a general purpose button then the script could get quite long with all the fields that need to be catered for, however it's all in one script!

Posted

That is what I did, I have three buttons that go to three different fields, the idea is to use only one script and specify the field name on the button parameter, the problem is on the go to field (or set field) script step where you do not have the possibility to add Get(ScriptParameter), because there is not a calculation condition to choose a field.

Posted

You need an If/End If construct for each field:

If (Get(ScriptParameter) = "field1")

Goto field (field1)

Exit Script

End If

If (Get(ScriptParameter) = "field2")

Goto field (field2)

Exit Script

End If

If (Get(ScriptParameter) = "field3")

Goto field (field3)

Exit Script

End If

You cannot target the field on a direct basis using calculated data. I suppose this makes sure that the script will always run as it cannot possibly address a badly named field from calculated data. Maybe you already made this conclusion.

Sorry if you already have this solution but I thought I'd make it clear for others as well.

Posted

You can make this significantly shorter by using the Else If[] script step:

If (Get(ScriptParameter) = "field1")

Goto field (field1)

Else If (Get(ScriptParameter) = "field2")

Goto field (field2)

Else If (Get(ScriptParameter) = "field3")

Goto field (field3)

End If

Another option is to loop a Go to Next Field[] step, until script parameter matches Get(ActiveFieldName). Neither is very pretty, but..

Posted

But a problem with these apporaches is that they beyond requirering a layout where the field is present, that if the field you need to reach is way down in a long line of tests ...why not make the whole nine yards, and make utility layouts for each field you need to reach.

Although a little tiresom for the developer to establish, will it give the exact same responsetime no matter which field.

Freeze Window

Go to Layout [ Evaluate(Get ( ScriptParameter )) ]

Go to Field [ ] [ Select/perform ]

Go to Next Field

Insert Calculated Result [ $aVar ] [ Select ]

Go to Layout [ original layout ]

Commit Records/Requests [ Skip data entry validation; No dialog ]

Borrowing boldly from this post.

...or checkout my attempt to template it...

--sd

mulitplex.zip

Posted

Using Else If[], is there a noticeable difference in response between the first test returning true, and say the 25th test? Enough to dedicate 25 layouts to this?

(Of course, with proper data structure, this shouldn't be required at all.)

Posted

(Of course, with proper data structure, this shouldn't be required at all.)

Are you taking my lines in the script, as well?? What you need to address as well is the use of repeating and global fields

I could have used you echoing in this thread:

http://www.fmforums.com/forum/showtopic.php?tid/176126/post/203515/hl//#203515

--sd

This topic is 6786 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.