애플리케이션 빌더를 사용하여 처음으로 JMP 추가 기능을 개발하려고 하는데 아래 설명된 JSL 스크립팅에 문제가 있습니다.
일부 배경:
인터페이스는 대화 상자 탭 아래에 구축되었습니다.
Columns, Roles, Action이라는 제목과 각각 ColumnsPanel, RolesPanel, ActionPanel이라는 변수 이름을 가진 세 개의 패널 상자가 있습니다.
열 패널 아래에 변수 이름이 ColList인 Col List Box(All)를 추가하여 열린 데이터 테이블의 모든 열을 가져옵니다.
역할 패널 아래에 3개의 열 목록 상자와 3개의 버튼 상자를 추가했습니다.
첫 번째, 두 번째 및 세 번째 Col 목록 상자의 변수 이름은 각각 ResponseColList, FactorColList 및 BlockColList입니다.
첫 번째, 두 번째, 세 번째 버튼 상자의 변수 이름은 각각 ResponseButton, FactorButton 및 BlockButton입니다.
첫 번째, 두 번째, 세 번째 버튼 상자의 제목은 각각 Response, Factor 및 Block입니다.
액션 패널 아래에 OK, Remove, Cancel이라는 제목과 각각 OKButton, RemoveButton, CancelButton이라는 변수 이름을 가진 3개의 버튼 상자를 추가했습니다.
응답 버튼을 클릭하면 ColList에서 속성 "A", "B", "C", "D" 및 "E" 열이 추가되었습니다.
마찬가지로 Factor and Block 버튼을 클릭하면 ColList의 "Site" 및 "People" 열이 추가됩니다.

스크립트:
//Part I
//Places selected columns into Role panel
On Response = Function({},
ResponseColList << Append( AllColList << Get Selected)
);
//Places selected columns into Factor panel
On Factor = Function({},
FactorColList << Append( AllColList << Get Selected)
);
//Places selected columns into Block panel
On Block = Function({},
BlockColList << Append( AllColList << Get Selected)
);
// Program the OK Button
On OK = Function({},
Response = ResponseColList << Get Items;
Factor = FactorColList << Get Items;
Block = BlockColList << Get Items;
// Get the current data table
dt = Current Data Table();
// Perform principal component analysis
pca = dt << Principal Components(
Y( Eval List( Response ) ),
Estimation Method( "NIPALS" ),
Standardize( "Standardized" )
);
pca << Save Principal Component Values( 3 );
pca << Close Window();
// Create a subset and delete columns "Prin1", "Prin2" and ""Prin3" in "dt"
dt << Subset(
Output Table("MET"),
All rows,
columns(Eval List(Block), Eval List(Factor), :Prin1, :Prin2, :Prin3)
);
dt << Delete Columns( "Prin1" ) << Delete Columns( "Prin2" ) << Delete Columns( "Prin3" );
// Standardize column attributes and create a data table "MET"
Current Data Table(Data Table("MET"));
For Each({col, index}, {:Prin1, :Prin2, :Prin3},
col << Format("Fixed Dec", 12, 2)
);
MET = Data Table( "MET" );
//Part II
//Get the levels in the Factor column
factorLevels = Associative Array(MET, Column(Eval List(Factor))) << Get Keys;
level1 = factorlevels[1];
level2 = factorlevels[2];
// Create two subsets named "Group1" and "Group2"
MET << Select Where( Column(Eval List(Factor)) == level1 ) << Subset( Output Table( "Group1" ), Selected Rows( 1 ), Selected columns only( 0 ) );
MET << Select Where( Column(Eval List(Factor)) == level2 ) << Subset( Output Table( "Group2" ), Selected Rows( 1 ), Selected columns only( 0 ) );
Group1 = Data Table( "Group1" );
Group2 = Data Table( "Group2" );
// Access the Site levels in "Group1" and "Group2"
Site_level1 = Column( Group1, "Site" ) << Get Values;
Site_level2 = Column( Group2 "Site" ) << Get Values;
);파트 I 스크립트를 성공적으로 실행할 수 있지만 파트 II에서 계속 오류가 발생하므로 코드 디버깅에 도움을 주셔서 정말 감사합니다.
여기서 또 다른 목표는 다양한 속성 이름(예: 속성 "F", "G" 등)을 가진 데이터세트를 처리하는 것입니다. 스크립트가 특정 이름을 하드코딩하는 대신 선택한 열 이름을 동적으로 사용하도록 하고 싶습니다.
감사합니다!
Part2의 어떤 부분이 실패하고 오류가 발생합니까?
연관 배열 - 데이터 테이블을 첫 번째 인수로 사용합니까?
Names Default to Here(1);
MET = Open( "$SAMPLE_DATA/Big Class.jmp" );
Factor={"height", "weight"};
Associative Array(MET, Column(Eval List(Factor)))