Skip 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.

Pass a field name to a script

Featured Replies

Hi,

Have been trying to do this for a couple of days but no luck so far.

I have a field in my database, when I click it a window will popup and user will do stuff and eventually select a value. When the user exits the popup - that value should be written to the field the user originally clicked.

I want to use this on several fields, by passing in the clicked field's name, and having the script update the calling field. I am trying to do this using the Get(ActiveFieldName) function.

Here is a test I have tried - have the text field act as a button that calls a script, passing in Get(ActiveFieldName). Script's contents are:

SetVariable[$i; Value:Get(ScriptParameter)]

SetField[test::txtfld; $i]

But no good. Am I using the function incorrectly?

Thanks,

I assume that the field object on the layout is formatted as a button to run the script... then why not put the name of the field into the script parameter on the button?

  • Author

Thanks very much - that works.

Next question: is there a dynamic way to set the target for a "Set Field" script step? I want to be able to update the field that was passed into the script as an arguement.

Try this:

http://fmforums.com/forum/showtopic.php?tid/179836/post/219571/#219571

--sd

Since there is a limited number of fields, and you know in advaance which fields are involved (since you've done their buttons) it isn't hard manually programming the Set Fields steps condiaionally based on the script parameter.

  • Author

Thanks for the link Soren, it looks like what I'm after but I can't get the Go To Object step to work if the target is script input. Please see attached - there are a couple of buttons where I'm trying different things such as Go To Object, Go To Field etc.

Vaughn, that's a very good idea, but this item will be used all over the solution, so would like to avoid hardcoding a list of target fields into an if statement if possible.

dynamic_edit.zip

Your file was locked so it was difficult to look around. I debugged your script and noticed that you were you were attempting to use to compare the name of your field with get(activefieldname). That cf actually only returns the field name portion of the field not the fully qualified field name

So instead of Table::Name it just returns name.

I attached a file that should help you. I don't really recommend using it though because it only works if the field is on the layout.

Also, if you have two fields with the same name you will end up in the topmost on the layout. Not necessarily ideal but hey... have fun with it.

login: Admin

no password

You shouldn't need that but if you do :

GoToField.zip

  • Author

Thanks very much, that did the trick

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.