개요
JMP ® 스크립팅 언어(JSL)를 사용하여 사용자에게 정보를 묻는 사용자 지정 창을 생성할 때 동일한 JMP 인스턴스 내에서 이전에 창을 시작한 설정을 복원하는 버튼을 추가하는 것이 바람직한 경우가 많습니다. 분석 메뉴를 클릭하고 배포를 선택하는 것과 같이 플랫폼을 대화형으로 시작할 때도 유사한 기능을 사용할 수 있습니다.
현재 Distribution 플랫폼 실행 및 Tables 메뉴 대화 상자에서 볼 수 있듯이 Recall 버튼을 만드는 내장 JSL 방법은 없습니다. 그러나 직접 구현할 수 있습니다.
다음 예제는 사용자가 활성 데이터 테이블의 열을 적절한 역할로 캐스팅할 수 있는 사용자 지정 창을 생성합니다. 확인 버튼을 클릭하면 사용자의 설정이 명명된 네임스페이스에 정의된 변수에 저장됩니다. 창을 다시 시작하면 호출 버튼이 현재 설정을 지우고 네임스페이스에서 값을 복원합니다.
지침
JMP 세션에서 파일 메뉴를 클릭하고 새로 만들기 ► 스크립트를 선택합니다. 아래 스크립트를 복사하여 스크립트 창에 붙여넣습니다. 샘플 스크립트를 실행하려면 편집 메뉴를 클릭하고 스크립트 실행을 선택합니다.
Names Default to Here(1);
/* Assign dt to reference a table. Open a sample table for demonstration purposes */
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
/* Use a named namespace to hold the recall values */
if(!Namespace Exists("Custom Dialog"), // define namespace if it does not exist
dialogRecallNS = New Namespace("Custom Dialog",
{
ycolRecall = {},
orderRecall = {},
byRecall = {}
});
, // else get a reference to the existing namespace
dialogRecallNS = NameSpace("Custom Dialog");
);
nc = N Col( dt );
lbWidth = 130;
/* Expression to clear all current settings */
clearRoles = Expr(
colListY << RemoveAll;
colListX << RemoveAll;
colListB << RemoveAll;
);
/* Expression to store the current settings in global variables */
recallRoles = Expr(
dialogRecallNS:ycolRecall = colListY << GetItems;
dialogRecallNS:orderRecall = colListX << GetItems;
dialogRecallNS:byRecall = colListB << GetItems;
);
/* Custom Launch Window */
customDlg = New Window( "Example of a Custom Dialog",
Border Box( Left( 3 ), top( 2 ),
V List Box(
Text Box( "Example dialog to demonstrate a Recall button" ),
H List Box(
V List Box(
Panel Box( "Select Columns",
colListData = Col List Box( All, width( lbWidth ), nLines( Min( nc, 10 ) ) )
)
),
Panel Box( "Cast Selected Columns into Roles",
Lineup Box( N Col( 2 ), Spacing( 3 ),
Button Box( "Y, Response", colListY << Append( colListData << GetSelected ) ),
colListY = Col List Box( width( lbWidth ), nLines( 5 ), numeric ),
Button Box( "X, Factor", colListX << Append( colListData << GetSelected ) ),
colListX = Col List Box( width( lbWidth ), nLines( 1 ), numeric ),
Button Box( "By", colListB << Append( colListData << GetSelected ) ),
colListB = Col List Box( width( lbWidth ), nLines( 1 ) )
)
),
Panel Box( "Action",
Lineup Box( N Col( 1 ),
Button Box( "OK",
recallRoles;
customDlg << CloseWindow;
),
Button Box( "Cancel", customDlg << CloseWindow ),
Button Box( "Reset", clearRoles ),
Text Box( " " ),
Button Box( "Remove",
colListY << RemoveSelected;
colListX << RemoveSelected;
colListB << RemoveSelected;
),
Button Box( "Recall",
clearRoles;
/* Restore any previous settings from the namespace variables */
Try(
colListY << Append( dialogRecallNS:ycolRecall );
colListX << Append( dialogRecallNS:orderRecall );
colListB << Append( dialogRecallNS:byRecall );
);
)
)
)
)
)
)
);
추가 문서
JMP 스크립팅 언어에 대한 자세한 내용은 다음에서 찾을 수 있습니다.JMP 스크립팅 가이드JMP 내에서 가이드에 액세스하려면 다음을 클릭하세요.돕다메뉴 및 선택JMP 도움말. 온라인 목차에서 다음을 선택하세요.스크립팅 가이드.
[이전 JMP 노트 46984]
스크립트를 살펴보니 필요한 것 같지만, 결과 플롯 스크립트를 추가하여 이점을 얻는 방법을 알아낼 수 없습니다. 원래 스크립트는 이렇게 생겼지만 리콜 버튼이 없습니다. 스크립트를 어디에 추가해야 할지 잘 모르겠습니다. 또한 이 스크립트를 모달로 만들어야 합니까?
슬 안
스패너헤드
dt = Current Data Table();
cd = Column Dialog(
exy = ColList( "Y", Min Col( 1 ) ),
exx = ColList( "X", Min Col( 1 ) )
);
Eval( cd[1] );
Eval( cd[2] );
yyy = Expr( y() );
xxx = Expr( x() );
xval = exx[1];
For( i = 1, i <= N Items( exy ), i++,
Insert Into( yyy, exy[i] )
);
For( i = 1, i <= N Items( exx ), i++,
Insert Into( xxx, exx[i] )
);
nw = New Window( "Annotated Multiple Plots",
For( i = 1, i <= N Items( exy ), i++,
Notes = exy[i] << Get Property( "Notes" );
Try(
Bivariate(
Y( exy[i] ),
X( exx[1] ),
SendToReport(
Dispatch(
{},
"",
AxisBox( 2 ),
Add Text Annotation(
Text( "Category: " || Notes ),
Fixed Size( 0 ),
Text Box( {-80, 25, 0, 50} ),
Filled( 0 )
)
)
)
)
);
)
);