다른 데이터 테이블에 의한 로컬 데이터 필터 업데이트여기요 !
저는 세 가지 주요 기능을 가지고 있으며, 기본적으로 두 개의 데이터 테이블이 있습니다. "마스터" 데이터 테이블에는 집계된 데이터가 있고, "슬레이브" 데이터 테이블에는 원시 측정 데이터가 있습니다. 제가 원하는 것은 (이전 회사에서는 가능했던 것처럼) 마스터 데이터 테이블의 행 상태 핸들러를 통해 슬레이브 테이블의 그래프 빌더 필터를 대화형으로 업데이트하는 것입니다. 어떤 이유에서인지 행 상태 핸들러는 제대로 작동하는데도 필터가 업데이트되지 않습니다. 기능적인 부분은 다음과 같습니다.
Row state handler:
===
rs = dtMaster << Make RowState Handler(f);
===
Dynamic filtering:
===
filteredKeys = dtMaster:SourceFile[Loc(selectedRows)];
filteredKeys = Associative Array( filteredKeys ) << Get Keys;
Try(
Eval(
Eval Expr(
detailFilter << Select Where(
Expr( filteredKeys ) == :SourceFile
)
)
);
,
Print( "Select Where failed" );
Show( filteredKeys );
);
===
===
Filter creation:
detailFilter = detailPlot << Local Data Filter( Close Outline( 1 ), Add Filter( Columns( :SourceFile ), Display( :SourceFile, N Items( 15 ), Find( Set Text( "" ), Contains Terms( 1 ), Contains Phrase( 0 ) ) ) ) );
txnelson 수정: JSL 블록으로 이동
자동화 및 스크립팅제목: 다른 데이터 테이블을 이용한 로컬 데이터 필터 업데이트Names Default To Here(1);
dt_raw = open("$SAMPLE_DATA/Big Class.jmp");
dt_main = dt_raw << Summary(
Group(:age),
Freq("None"),
Weight("None"),
Link to original data table(0),
output table name("Summary of Big Class grouped by age")
);
gb = dt_raw << Graph Builder(
Size(658, 550),
Show Control Panel(0),
Variables(X(:age), Y(:height)),
Elements(Points(X, Y, Legend(4)))
);
ldf = gb << Local Data Filter(
Close Outline(1),
Add Filter(columns(:age), Display(:age, N Items(6)))
);
f = Function({a},
selrows = dt_main << Get Selected Rows;
selvals = As List(dt_main[selrows, "age"]); // drop unique if necessary
ldf << (Filter Column(:age) << Where(:age == selvals));
);
rs = dt_main << Make RowState Handler(f);
행 상태 핸들러를 사용하는 것보다 훨씬 더 나은 옵션이 있을 수 있지만, 제공된 정보만으로는 판단하기 어렵습니다.
제목: 다른 데이터 테이블을 이용한 로컬 데이터 필터 업데이트여기요,
좀 더 자세한 코드를 보여드리겠습니다. 전체 코드인데, 민감한 정보는 전혀 없습니다.
제안된 해결책을 테스트해봤지만 필터에 아무런 변화가 없었습니다. WHERE 절을 제거했더니 필터 수가 훨씬 늘어났는데, 제가 원하는 것은 필터링된 값을 변경하는 것입니다.
필터를 삭제하고 새 필터를 생성하는 더미 프로토타입을 만들었는데, 렉이 심합니다.
좀 더 세련된 아이디어라면 무엇이든 환영합니다 
Names Default To Here( 1 );
/*
USER SETTINGS
-------------
Change these names to match your open JMP data tables and columns.
*/
dtMaster = Data Table( "peak_summary" ); // Table containing the master XY plot
dtDetail = Data Table( "all_parsed_data" ); // Table containing raw/calculated data
sourceColMaster = "SourceFile";
sourceColDetail = "SourceFile";
// Master plot columns
masterXCol = "X";
masterYCol = "Y";
masterColourCol = "MasterValue";
// Detail plot columns
detailXCol = "X";
detailYCol = "Y";
detailColourCol = "CalculatedValue";
// Helper column in detail table
linkColName = "_Selected_By_Master";
// Behaviour when nothing is selected in master plot:
// 1 = show all detail rows
// 0 = show no detail rows
showAllWhenNothingSelected = 1;
/*
CREATE / RESET HELPER COLUMN IN DETAIL TABLE
*/
If(
Try( Is Missing( Column( dtDetail, linkColName ) << Get Name ), 1 ),
dtDetail << New Column(
linkColName,
Numeric,
Nominal,
Set Each Value( 1 )
)
);
colLink = Column( dtDetail, linkColName );
/*
FUNCTION:
Update detail-table helper column based on selected SourceFile values
in the master table.
*/
rs = dtMaster << Make RowState Handler(f);
Update Detail Filter = Function( {},
{selRows, selectedSources, i, r, sf, detailRows},
selectedSources = {};
selectedRows = dtMaster << Get Row States;
filteredKeys = dtMaster:SourceFile[Loc(selectedRows)];
filteredKeys = Associative Array( filteredKeys ) << Get Keys;
detailFilter << (
Filter Column( :SourceFile ) <<
Where(
:SourceFile == "filteredKeys" // Not performing anything
)
);
);
/*
CREATE MASTER PLOT
Selection in this plot drives the second plot.
*/
masterPlot = dtMaster << Graph Builder(
Size( 700, 600 ),
Show Control Panel( 0 ),
Variables(
X( Column( dtMaster, masterXCol ) ),
Y( Column( dtMaster, masterYCol ) ),
Color( Column( dtMaster, masterColourCol ) )
),
Elements(
Points( X, Y, Legend( 1 ) )
)
);
f = Function( {a}, Print( a ) );
/*
CREATE DETAIL PLOT WITH LOCAL DATA FILTER
The Local Data Filter keeps only rows where _Selected_By_Master == 1.
*/
detailPlot = dtDetail << Graph Builder(
Size( 657, 556 ),
Show Control Panel( 0 ),
Variables( X( :Frequency_GHz ), Y( :S11Mag_dB ) ),
Elements( Smoother( X, Y, Legend( 7 ), Lambda( 0.000001 ) ) ),
);
detailFilter = detailPlot << Local Data Filter(
Close Outline(1),
Add Filter(columns(:SourceFile), Display(:SourceFile, N Items(6)))
);
/*
ROW STATE HANDLER
This fires whenever row states change in the master table,
including point selection from the master XY plot.
IMPORTANT:
Keep this handler variable alive.
If it goes out of scope, the handler may stop working.
*/
::MasterToDetail_RowStateHandler = dtMaster << Make Row State Handler(
Function( {changedRows},
Update Detail Filter();
)
);
/*
Initial update
*/
Update Detail Filter();
txnelson 수정: JSL 블록으로 이동
-일마리 (우린 예전에 같은 회사에서 일했었지)
제목: 다른 데이터 테이블을 이용한 로컬 데이터 필터 업데이트괜찮아요, 자르모. 제가 해결했어요. 당신의 방법이 효과가 있었어요.