정기적으로 업데이트되는 두 개의 데이터 소스가 있는데, 이로 인해 새로운 열이 생성됩니다. 이 데이터 소스들은 JSL 스크립팅을 통해 병합되었는데, 잘 작동하지만, 열이 추가될수록 확장되는 열 전환 기능이 있는 그래프를 임베드하고 싶습니다.
예를 들어, HPLC 데이터가 기기 A와 기기 B에서 수집되었다고 가정해 보겠습니다. 각 열은 별도의 샘플이며, 시간이 지남에 따라 샘플이 더 추가됩니다. 'A' 샘플에 대한 최종 데이터 표에 간단한 XY 차트를 만들어 열이 더 추가될수록 열 전환기(column switcher)도 커지도록 하고 싶습니다. (나중에 세 번째 기기를 추가하면 B와 C도 마찬가지입니다.)

B와 데이터를 병합하기 전에 A 테이블에서 변수를 만들었지만, 최종 테이블에서 변수를 인식하거나 명시적인 열 이름을 가질 수 있도록 목록을 전달(또는 평가)하려면 어떻게 해야 합니까?
A_columns = dt_A <<GET column="" names=""></GET><BR />//Merge A and B based on time column<BR /><BR />Final_Table =dt_B << Update(<BR />With(dt_A)),<BR />Match Columns( :Time = :Time)<BR />);<BR />Final_Table <<NEW script=""></NEW>Graph Builder(<BR />Size( 546, 565 ),<BR />Show Control Panel( 0 ),<BR />Variables( X( :Time ), Y( A_columns[1] ) ),<BR />Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ),<BR />Column Switcher( A_columns[1], A_columns)<BR />);
최종 테이블에서 열 목록을 가져올 때는 이 방법이 잘 작동하는 듯하지만, 다른 테이블에서 생성된 변수를 사용하려고 하면 문제가 발생합니다.
열 전환기에서 첫 번째 열(:Time)에 대해서만 항상 모든 것을 사용하고 싶으신가요?
이 경우에는 그렇습니다. 항상 첫 번째 열은 같은 이름을 갖습니다.
그 경우에는 테이블 스크립트 내에서 열 목록을 동적으로 빌드하는 것을 고려합니다.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
table_script_expr = Expr(
cols = Current Data Table() << Get Column Names();
Remove From(cols, 1); // drop first column
gb = Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:lot_id), Y(Eval(cols[1]))),
Elements(Points(X, Y, Legend(3)))
);
gb << Column Switcher(
cols[1],
Remove(cols, 1)
)
);
Eval(EvalExpr(
dt << New Script("Graph",
Expr(NameExpr(table_script_expr))
);
));
그래프를 만들고 스크립트로 저장하면 평가를 피할 수 있습니다(저는 이 "트릭"을 꽤 자주 사용합니다)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
cols = dt << Get Column Names();
Remove From(cols, 1); // drop first column
gb = dt << Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:lot_id), Y(Eval(cols[1]))),
Elements(Points(X, Y, Legend(3))),
Column Switcher(
cols[1],
Remove(cols, 1)
),
Invisible
);
gb << Save Script to Data Table("Graph"); // this will remove the need for evaluation
wait(0);
gb << close window;
그리고 당신이 평가하고 싶다면
// If you wish to evaluate, this should work even though the script will look a bit weird due to lack of ":" in columns
// If it doesn't you for some reason, you will have to build the list in a bit different manner for evaluation
Eval(EvalExpr(
dt << New Script("Graph2",
Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:lot_id), Y(Expr(cols[1]))),
Elements(Points(X, Y, Legend(3))),
Column Switcher(
Expr(cols[1]),
Expr(Remove(cols, 1))
)
)
)
));