Ciao, stavo scrivendo del codice JSL per elaborare un file sorgente e speravo di riutilizzarlo/adattarlo. A tal fine, ho creato alcune variabili molto semplici che intendevo modificare solo occasionalmente.
Ecco una breve sezione di JSL che crea variabili e le utilizza in una formula di colonna. Questi non sono i nomi originali. Li ho modificati per semplificare:
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:
Vorrei solo che lo script applicasse QUESTA formula alla nuova colonna, ovvero valutasse la parte relativa alle variabili dello script. Ma non so come farlo.
Preferirei NON utilizzare variabili di tabella.
Grazie per la lettura!
Dovrai valutarli Inserire un'espressione in un'altra utilizzando Eval Insert, Eval Expr, Parse e Substitute
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
myvar = 100;
Eval(EvalExpr(
dt << new column("A", Numeric, Continuous, Formula(
:height * Expr(myvar)
));
));