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.

Script Step doesn't accept parameter

Featured Replies

This is a problem with passing a parameter to a script to tell it which layout to use.

I have created a script that opens a Layout and Sets a field in that layout. Simple.

Now imagine a Layout with a half-dozen buttons. Each button runs this same script, but the Layout it goes to is different for each button.

I could make 6 copies of the script, modifying each one to change the name of its destination layout.

But I’d prefer to write the script once, then have each button pass a parameter with the name of its destination layout.

The Script step “Go to Layout” accepts a parameter to tell it which layout to go to.

The Script step “Set Field” does not.

So, using parameter passing, I can get to the proper layout, but, once I’m there, I can’t set a field on that layout.

Any ideas?

It sounds like you're trying to pass multiple parameters in one script. To do this you need to create a delimited list of parameters and pull them out using text manipulation etc.

One easy way to do this is to pass a list of parameters as a return-delimited list, and use the MiddleValues() function together with Get(ScriptParameter) to pull out the right parameter when you need it.

The Script step “Go to Layout” accepts a parameter to tell it which layout to go to.

The Script step “Set Field” does not.

So, using parameter passing, I can get to the proper layout, but, once I’m there, I can’t set a field on that layout.

If I understand you correctly you want to pass parameters to your script that indicate not only what layout to navigate to but also the name of a field to set. A problem with the "Set Field" script step is that it does not allow the target field to be specified through a calculation. This is the subject of an old post and it includes a couple of hacks. See the link for more details: Wants and Wishes

A problem with the "Set Field" script step is that it does not allow the target field to be specified through a calculation.

Well it's not too complicated to make:

If [ PatternCount ( FieldNames ( Get ( FileName ) ; Get ( LayoutName ) ) ; LeftValues(Get ( ScriptParameter );1) ) ] 

     Go to Field [  ] [ Select/perform ] 

     Go to Next Field 

     Loop 

          Exit Loop If [ Get ( ActiveFieldName ) & "¶" = LeftValues(Get ( ScriptParameter );1) ] 

          Go to Next Field 

     End Loop 

     Set Field [ Substitute ( Trim ( Substitute ( RightValues ( Get ( ScriptParameter ) ; 1 ) ; "¶" ; " " ) ) ; " " ; "¶" ) ] 

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

End If 

First value in the paramter is the fieldname you wish to send a value to and the second is the value in itself. Only thing missing is to put the scriptparamters to each button, the script is the one and same.

--sd

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.