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

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

Recommended Posts

Posted (edited)

Howdy, all:

I'm trying to learn how to implement variables but am unsure how to insert them and where.

For a runtime solution I'm working on, the attached report-generating script is used for six different-named fields; the script is identical for each one save for the highlighted steps; that's where the different field names plug in but they all end up using the same print layout. For example, AC_Tail_Number is one field used in the attached script, Serial_Number is another field that would/could use the same script and so on for all six fields.

If a variable is used I imagine it'll be a global one (?)

Cheers,

Rich

Variable_Question.gif

Edited by Guest
Upload didn't
Posted

You can script a Find like this:

Enter Find Mode

Set Field( myField ; $myValue )

Perform Find

But you can't do this:

Enter Find Mode

Set Field( $myField ; $myValue )

Perform Find

In other words, the field itself can't be dynamically selected -- the field name can't be a variable. You can work around this by using a specific layout to perform your find, and giving each field an object name. Then you can script:

Enter Find Mode

Go to object( $myField )

Set Field( *don't select any field* ; $myValue )

Perform Find

As for Sorts, they can't be specified dynamically at all. About the best you can do is something like:

If( $myVariable = "name" )

Perform Sort

Else If( $myVariable = "date" )

Perform Sort

Else If etc. etc.

Good standard practices are:

- Declare all your variables at the top of your script, so you can keep track of them.

- Use a standard name such as $param and assign Get(ScriptParameter) to it, again right at the top of the script

- Don't use global variables unless you have a good reason. It just makes more work to clean them up when you're done.

Posted

Thanks, Fitch! Indeed, I should (make that, will) learn the proper nomenclature and structure standards for FM.

I hope you survived the wind and rains okay during the last few days; it's not often you get hurricane winds in Portland. (If Powell's inventory got waterlogged it'll definitely be a tragic loss.)

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