Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Set Field where field name is variable

Featured Replies

Is it possible to use a Set Field script step where the name of the field you are setting is a variable? Using the GetField command I can specify the outcome as a variable field name. Can it be done on the left hand side of the equation?

For example:

Set Field ["i" "1"]

Loop

Set Field ["ResultField1" "GetField(gVarFieldName)"]

Set Field ["gVarFieldName" ""OutcomeField" & i"]

Set Field ["i" "i+1"]

End Loop

First iteration ResultField1 is set to OutcomeField1. Next time through to OutcomeField2, etc.

Is there any way to increment the field being set, so that the first time ResultField1 would be set, then ResultField2, etc.

In a similar vein, is there any way to set the repetition of a field that is being set with a variable.

It seems like so many of these things could be done with incrementing loops, but it sure feels like I'm doing a lot of manual mouse clicks.

Thanks for any help,

Dan

Unfortunately, Dan, I believe the answer is no on both counts. The way I usually get around this is to have a layout with the fields in the order you will set them. Then you can use Go to Next Field, as long as the tab order is set correctly, to loop through the fields without hard-coding each one. This is very handy for setting repetitions, as well. You can use a global counter that either stores the number of repetitions, number of fields, or the field name at which to stop, and Exit Loop accordingly.

  • Author

Great idea! That's not too hard to set up. Thanks!

Dan

It sure would be nice to be able to specify the field programatically, though. Maybe someday...

I should also add that when using Set Field, you'll want to leave it unspecified and only enter the calculation. That combined with Go to Next Field is what does the trick.

Hi Dan,

Apart the loop process on a specific layout with a tab order, as Queue suggested, you can also have your Result simply set this way.

Say Outcome_1, Outcome_2, Outcome_3,...

SetField[g_counter,0]

SetField[g_variableFieldName, "Outcome_"]

GoToLayout[TheOnWithResultsInOrder]

GoToField[first]

Loop

EndLoopIf[g_counter = x iterations]

SetField[g_counter,g_counter+1]

SetField[,GetField(g_variableFieldName&g_counter)]

GoToNextField

EndLoop

Just in case crazy.gif

Of course it's easy with applescript.

setField(targetField, sourceField)

on setField(x,y)

get data cell y of current record

copy result to y

get data cell x of current record

copy result to x

copy y to cell x of current record

end setField

Regarding repeating fields, they can be individually addressed by using lookups.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.