Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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

Posted

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.

Posted

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.

Posted

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.

  • Like 1

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