August 27, 201411 yr 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?  Â
August 27, 201411 yr 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.
August 27, 201411 yr 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.
August 27, 201411 yr 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?
August 27, 201411 yr 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.
Create an account or sign in to comment