안녕하세요, 소스 파일을 처리하는 JSL을 작성하고 있었는데, 소스 파일을 재사용하거나 수정하려고 했습니다. 이를 위해 아주 간단한 변수 몇 개를 만들어서 가끔씩만 변경하도록 했습니다.
다음은 변수를 생성하여 열 수식에서 사용하는 JSL의 짧은 섹션입니다. 원래 이름은 아닙니다. 간단하게 변경했습니다.
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:
스크립트에서 이 수식을 새 열에 적용해서 스크립트 변수 부분을 평가하고 싶은데, 어떻게 해야 할지 모르겠습니다.
저는 테이블 변수를 사용하지 않는 것을 선호합니다.
읽어주셔서 감사합니다!
Eval Insert, Eval Expr, Parse 및 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)
));
));