Jump to content
Server Maintenance This Week. ×

Can one reference fields INDIRECTLY in scripts?


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

Recommended Posts

  • Newbies

Hey,

I see Script steps that allow me to go to a layout or record by a number. But is there any way to reference a FIELD indirectly? Eg, to go to, copy from, paste into, or set a field without specifying a specific field-name, but rather specifying a global VARIABLE which POINTS to the desired field (by number or name), so that I could use a loop to change 40 fields without doing them 1 at a time.

Thanks!

Eliot

Version: v5.x

Platform: Mac OS 9

Link to comment
Share on other sites

GetField() allows you to "indirectly" reference a field. If you named your fields in a pattern like "Field1", "Field2", you could construct a tight loop using GetField("Field" & NumToText(myCounter)). Of course, naming fields without meaningful names is a programming no-no...

Link to comment
Share on other sites

  • Newbies

Thanks Sam!

I did get the GetField(field) function to work, but after your response, I was hoping to be able to write something like:

Set Field ( GetField(CurCategory), RunningSum)

... but the Set Field ScriptStep seems to take only literal references (ie, a specific field name) for the first parameter. (I'm using FM5).

So... 1) Is there a way to SET (or Paste, or whatever), as well as Get, with indirect reference?

And 2) Can one use GetField and any indirect SetField to reference fields in RELATED records?

Here are the work-arounds I am considering. Are there betters ways?

Re 1: If there is no set function with indirect reference, perhaps the best thing is to create a layout and use "Go To Next Field" and then Paste into it.

Re 2: If GetField doesn

Link to comment
Share on other sites

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