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.

Using setVariable in a script across different files

Featured Replies

Hi there,

 

Im trying to get the hang of setVariable and am having trouble getting variables acquired in one file to be set in another file. Can setVariables  be used across files?

 

post-65694-0-33003700-1409098975_thumb.p

 

post-65694-0-44405700-1409098985_thumb.p

Local variables ($) do not live beyond the scope of a script.  In your example those variables are not set in the script so they do not exist.

Global variables ($$) do live beyond scripts but not across multiple files.

 

If you want to use variables from one file in another then you pass them along as script parameters to a script in the second file.

No, you need to pass the data by other means; e.g. as a script parameter.

 

But you could also just add a layout based on a TO of the second file, so the steps of your two scripts could be combined into one and performed entirely in the first file.

  • Author

Ive looked at script parameters but can't work out how to apply them to my problem. Can anyone give me an example of using this to pass variables from one file/script to another?

Can anyone give me an example of using this to pass variables from one file/script to another?

 

 

Script A in File A:

Set Variable [ $myvar; Value:Table A::Some Field ]
# DO SOME LOCAL STUFF HERE
Perform Script [ “Script B” from file: “B”; Parameter: $myvar ]
# MORE LOCAL STUFF HERE, IF NECESSARY

Script B in File B:

Go to Layout [ “Table B” ]
New Record/Request
Set Field [ Table B::Another Field; Get ( ScriptParameter ) ]
Commit Records/Requests

NOTE:

Only a single value can be passed. If you have more than one, then you have to find a way to combine them in such way that the receiving script can parse them out reliably. There are numerous such methods - but the easiest thing to do here, IMHO, is to combine the two files into one.

  • Author

thanks Comment  :laugh2:

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.