The script below loads some data and should create twice the same plot.<BR />The first one by referring to the column name by using a variable (test1), the second one by calling the column name directly.
The second one works fine, but for the first one I get an empty plot area. I guess there is a problem with how I define or call test1. I have tried different approaches, but so far nothing worked.
Names Default To Here( 1 );
// Import the Excel file with specified settings
dt = Open(
"/Y:/.../file.xlsx",
Worksheets( "Pivot table for JMP" ),
Worksheet Settings(
1,
Has Column Headers( 1 ),
Headers Start on Row( 2 ),
Data Starts on Row( 3 )
)
);
// Filter rows to include only "AAA" in "Common Designation"
dt_AAA = dt << Subset(
Rows( :Common Designation == "AAA" ),
Include All Columns,
Name( "Filtered AAA" )
);
size = "AAA" ;
Match( size,
"AAA", test1 = column ("PL (min)"),
);
New Window( size,
V List Box(
Graph Builder(
Size( 500, 297 ),
Show Control Panel( 0 ),
Variables( X( :test1 ), Y( :Chemistry ), Color( :Chemistry ) ),
Elements( Points( X, Y, Legend( 106 ) ) )
),
Graph Builder(
Size( 500, 297 ),
Show Control Panel( 0 ),
Variables( X( :"PL (min)"n ), Y( :Chemistry ), Color( :Chemistry ) ),
Elements( Points( X, Y, Legend( 106 ) ) )
),
),
);
제가 제대로 이해했다면, 첫 번째 그래프 빌더 스크립트에서 test1 앞에 있는 콜론만 제거하면 될 것 같습니다. 다음은 정상적으로 작동하는 예시 스크립트입니다.
Names Default To Here (1);
dt = open ("$SAMPLE_DATA/big class.jmp");
test1 = column ("weight");
Graph Builder (
Variables (X(test1), Y(:height), color (:sex))
);
이런 버그를 찾는 멋진 팁:
오류가 발생하는 스크립트에서 점점 더 많은 줄을 제거합니다. 오류가 발생하기에 필요한 만큼의 줄만 남을 때까지 말입니다.
중요: 코드는 오류를 발생시키는 모든 요소를 포함해야 합니다. 코드를 실행하는 모든 사람이 이를 확인할 수 있어야 합니다.
이것에는 두 가지 장점이 있습니다.
- 대부분의 경우 버그는 자동으로 발견됩니다. 코드 한 줄만 삭제하면 버그가 사라집니다.
- 나머지 코드는 매우 짧아서 버그를 훨씬 쉽게 찾을 수 있습니다.
*) 제 시스템에서는 다음과 같은 오류 메시지와 함께 충돌이 발생했습니다:

훨씬 낫습니다. @Jed_Campbell 님의 예시처럼 샘플 파일 중 하나를 사용하세요.
이것은 또 다른 이점이 있습니다. 다음과 같은 것들을 구분할 수 있습니다.
- 제 데이터 테이블에 오류가 있습니다 (예제 데이터를 사용하니 오류가 사라졌습니다).
- 제 스크립트에 오류가 있습니다 (샘플 데이터를 사용해서 오류를 재현할 수 있습니다).