안녕 모두,
사용자가 프로세스의 다음 단계를 수행할 행을 선택할 수 있기를 원하기 때문에 최근에 Table Box() 기능을 사용하여 일부 정보를 새 창에 요약하는 JSL을 작성하기 시작했습니다. 때로는 대화형 테이블 상자를 만드는 것이 번거로울 수 있습니다.또한 최근에 Get As Report 명령을 사용하여 데이터 테이블을 대화형 테이블 상자와 같은 인터페이스로 전환할 수 있다는 사실을 알게 되었습니다. 그러면 인터페이스를 훨씬 쉽고 빠르게 구축할 수 있습니다.
예를 들어 다음 JSL을 참조하십시오.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Boston Housing.jmp" );
RptWin = New Window( "Data Table as report",
Outline Box("Data Table as Report",
dt_Rpt = dt << Get as Report();
)
);
내가 겪고 있는 유일한 문제는 테이블 상자에서 할 수 있는 것처럼 새 창에서 출력을 사용하는 방법입니다.
테이블 상자 환경에서 함수를 설정하여 선택한 정보 내에서 코드 아래에서 사용할 수 있는 정보를 반환하도록 할 수 있습니다. 그러나 Get As Report 명령으로는 그렇게 할 수 없습니다. 최소한 그 방법에 대한 예제를 찾지 못했고 Scripting Index에는 Get As Report 명령에 대한 내용이 많지 않습니다.
다음 코드는 한 번에 하나의 행을 선택할 수 있는 테이블 상자를 만든 방법의 예입니다.
tb = Table Box(
Number Col Box( "PC Number", Eval List( PC_n ) ),
Number Col Box( "Eigenvalue", Eval List( PC_eigv ), <<SET format=""> 1, Throw( "Too many items selected!\!rOnly one selection possible." ),
N Items( SelRows ) == 1,
SelRows = this << Get Selected Rows;
N_PCs = SelRows[1];
);
)
)
)</SET>Get As Report 출력을 사용할 때 동일한 종류의 기능을 사용할 수 있는 방법이 있습니까?
의견을 보내 주셔서 감사합니다!,
DS
안녕 @ih ,
예, 완벽합니다! 그것은 실제로 완전히 의미가 있으며 왜 그렇게 생각하지 않았는지 모르겠습니다.
빠른 해결책에 다시 한 번 감사드립니다!,
DS
물론이지. 그래프는 이미 테이블에 연결되어 있으므로 Set Row Change Function에 아래 두 행을 추가하기만 하면 해당 동작이 표시되어야 합니다.
tb << Set Row Change Function(
Function( {this},
{SelRows},
SelRows = this << Get Selected Rows;
If(
N Items( SelRows ) > 1, Throw( "Too many items selected!\!rOnly one selection possible." ),
N Items( SelRows ) == 1,
SelRows = this << Get Selected Rows;
NPCs = SelRows[1];
);
// ** Added next two lines **
dt_results << Clear Select;
dt_results << Select rows(SelRows);
)
);안녕 @ih ,
빠른 답변과 해결책에 감사드립니다. 바로 제가 찾던 것입니다. 완벽하게 작동합니다. 구현하려고 시도한 더 큰 코드는 다음과 같습니다. 나는 이것이 별도의 주제라는 것을 알고 있지만 우연히 사용자가 테이블 상자의 행을 클릭할 때 강조 표시되도록 Get As Report 테이블 상자가 있는 아래 코드의 그래프 빌더 디스플레이를 연결하는 방법을 알고 계십니까? 그래프 빌더의 해당 데이터 포인트?그건 그렇고, 저는 Boston Housing을 응답으로 mvalue가 있는 샘플 데이터 세트로 사용하고 파티션의 예측 변수로 다른 모든 열을 사용하고 있습니다. 그리고 0.3의 검증 부분을 사용하고 있습니다.
감사해요!,
DS
Names Default To Here( 1 );
lbWidth = 168;
dt = Open( "$SAMPLE_DATA/Boston Housing.jmp" );
// Expression to store the current settings in global variables
recallRolesS1 = Expr(
::dtchosenRecall = dtchosen
);
// Expression to clear all current settings. KW: Clear
clearRoles = Expr(
Try(
colListY << RemoveAll;
ColListX << RemoveAll;
ColListW << RemoveAll;
ColListF << RemoveAll;
colListV << RemoveAll;
)
);
// Expression to store the current settings in global variables
recallRoles = Expr(
::ycolRecall = colListY << GetItems;
::xcolRecall = colListX << GetItems;
::WcolRecall = colListW << GetItems;
::FcolRecall = colListF << GetItems;
::vcolRecall = colListV << GetItems;
::max_spRecall = max_sp_input << get;
::partVPRecall = partVP_input << Get;
);
//Function to choose the data table to model. KW: choose_data
choose_data_table = Function( {},
list = {};
For( i = 1, i <= N Table(), i++,
list[i] = Data Table( i ) << get name
);
win = New Window( "Select a data table",
<<MODAL> 1, Throw( "Too many items selected!\!rOnly one selection possible." ),
N Items( SelRows ) == 1,
SelRows = this << Get Selected Rows;
NPCs = SelRows[1];
);
)
);
);
Part = Expr(
If(
N Items( vcols ) == 1,
dt_results = New Table( "Partition_Results",
Add Rows( max_sp ),
New Column( "Splits", Numeric, Continuous ),
New Column( "Training RSquare", Numeric, Continuous ),
New Column( "Validation RSquare", Numeric, Continuous ),
New Column( "Training RASE", Numeric, Continuous ),
New Column( "Validation RASE", Numeric, Continuous ),
New Column( "Training N", Numeric, Continuous ),
New Column( "Validation N", Numeric, Continuous ),
New Column( "RSquare Diff", Numeric, Continuous, Formula( "Training RSquare"n - "Validation RSquare"n ) ),
New Column( "Penalized Valid RSquare", Numeric, Continuous, Formula( "Training RSquare"n - 0.05 * "Splits"n ) )
),
N Items( vcols ) == 0 & Is Missing( partVP ) == 0,
dt_results = New Table( "Partition_Results",
Add Rows( max_sp ),
New Column( "Splits", Numeric, Continuous ),
New Column( "Training RSquare", Numeric, Continuous ),
New Column( "Validation RSquare", Numeric, Continuous ),
New Column( "Training RASE", Numeric, Continuous ),
New Column( "Validation RASE", Numeric, Continuous ),
New Column( "Training N", Numeric, Continuous ),
New Column( "Validation N", Numeric, Continuous ),
New Column( "RSquare Diff", Numeric, Continuous, Formula( "Training RSquare"n - "Validation RSquare"n ) ),
New Column( "Penalized Valid RSquare", Numeric, Continuous, Formula( "Validation RSquare"n - 0.05 * "Splits"n ) )
),
N Items( vcols ) == 0,
dt_results = New Table( "Partition_Results",
Add Rows( max_sp ),
New Column( "Splits", Numeric, Continuous ),
New Column( "Training RSquare", Numeric, Continuous ),
New Column( "Training RASE", Numeric, Continuous ),
New Column( "Training N", Numeric, Continuous ),
New Column( "Penalized Train RSquare", Numeric, Continuous, Formula( "Training RSquare"n - 0.05 * "Splits"n ) )
)
);
For( i = 1, i <= max_sp, i++,
dt_results:"Splits"n[i] = i
);
dt_name = dtchosen << Get Name;
For( i = 1, i <= N Rows( dt_results ), i++,
Psplit = dt_results:"Splits"n[i];
str = Eval Insert(
"report = (dtchosen<<PARTITION></PARTITION></MODAL>Get are Report() 함수에서 반환된 참조 참조에서 한 수준 낮은 테이블로 이동하면 됩니다.이 시도:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Boston Housing.jmp" );
RptWin = New Window( "Data Table as report",
Outline Box("Data Table as Report",
dt_Rpt = dt << Get as Report();
)
);
tb = dt_Rpt[Table Box( 1 )];
tb << Set Shade Headings( 1 );
tb << Append(
Plot Col Box( "",
:mvalue << get values,
<<SET scale=""> 1, Throw( "Too many items selected!\!rOnly one selection possible." ),
N Items( SelRows ) == 1,
SelRows = this << Get Selected Rows;
N_PCs = SelRows[1];
);
)
);</SET>