Hello, I was writing some JSL to process a source file, and hoping to reuse/adapt the source file. To that end I created a few very simple variables that I intended to change only occasionally.
Here is a short section of JSL that creates variables and uses them in a column formula. These are not the original names. I changed to keep it simple:
JMP v18.2.0
dt = current data table();
VariableA = 42; // A value I intend to change occasionally depending on the details of the source data
VariableB = 1; // Another value I'll change depending on the source data.
dt << New Column( "A_New_Formula_Coumn",
numeric,
ordinal,
Formula( :An_Existing_Data_Column - VariableA * VariableB )
);
dt << New Column( "A_Simpler_New_Formula_Coumn",
numeric,
ordinal,
Formula( :An_Existing_Data_Column - 42 )
);
I've run this in an external script and from a script in the table. Both seem to have no trouble when the script is first run. The problem is that "VariableA" and "VariableB" are used in the column formula, almost as if they are local variables. But they aren't defined anywhere. So when I close JMP down completely and reopen it - only then do I get a warning that there is something wrong with the formula:
I really just want the script to apply THIS formula to the new column, i.e. evaluate the script variable portion. But I don't know how to do that.
I'd prefer NOT to use table variables.
Thanks for reading!