<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Local data filter update by another data table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Local-data-filter-update-by-another-data-table/m-p/954903#M110050</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt_raw = open("$SAMPLE_DATA/Big Class.jmp");

dt_main = dt_raw &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; Graph Builder(
	Size(658, 550),
	Show Control Panel(0),
	Variables(X(:age), Y(:height)),
	Elements(Points(X, Y, Legend(4)))
);

ldf = gb &amp;lt;&amp;lt; Local Data Filter(
	Close Outline(1),
	Add Filter(columns(:age), Display(:age, N Items(6)))
);

f = Function({a},
	selrows = dt_main &amp;lt;&amp;lt; Get Selected Rows;
	selvals = As List(dt_main[selrows, "age"]); // drop unique if necessary
		
	ldf &amp;lt;&amp;lt; (Filter Column(:age) &amp;lt;&amp;lt; Where(:age == selvals));
);

rs = dt_main &amp;lt;&amp;lt; Make RowState Handler(f);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There might be (much) better options than using row state handler but it is impossible to tell with the information provided.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jun 2026 18:31:46 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2026-06-22T18:31:46Z</dc:date>
    <item>
      <title>Local data filter update by another data table</title>
      <link>https://community.jmp.com/t5/Discussions/Local-data-filter-update-by-another-data-table/m-p/954889#M110048</link>
      <description>&lt;P&gt;Hey !&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have three main functions, and what I basically have is two data tables where "Master" data table has aggregated data and the other "Slave" data table has raw measurement data. What I want (and previously was able to do in another company) to do is interactively update Slave tables graph builder filter by row state handler in the Master data table. For whatever reason, the filter is not updated although the row state handler is functioning. The functional parts:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Row state handler: 

===

rs = dtMaster &amp;lt;&amp;lt; Make RowState Handler(f);

===

 

Dynamic filtering:

===

 filteredKeys = dtMaster:SourceFile[Loc(selectedRows)];
filteredKeys = Associative Array( filteredKeys ) &amp;lt;&amp;lt; Get Keys;
 
 
    Try(
        Eval(
            Eval Expr(
                detailFilter &amp;lt;&amp;lt; Select Where(
                     Expr( filteredKeys ) == :SourceFile   
                )
            )
        );
        ,
        Print( "Select Where failed" );
        Show( filteredKeys );
    );
 
===
 
 
===
 
Filter creation:
 
detailFilter = detailPlot &amp;lt;&amp;lt; Local Data Filter( Close Outline( 1 ), Add Filter( Columns( :SourceFile ), Display( :SourceFile, N Items( 15 ), Find( Set Text( "" ), Contains Terms( 1 ), Contains Phrase( 0 ) ) ) ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;txnelson edit: moved to JSL block&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2026 22:58:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Local-data-filter-update-by-another-data-table/m-p/954889#M110048</guid>
      <dc:creator>UnrelatedLamb77</dc:creator>
      <dc:date>2026-06-22T22:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Local data filter update by another data table</title>
      <link>https://community.jmp.com/t5/Discussions/Local-data-filter-update-by-another-data-table/m-p/954903#M110050</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt_raw = open("$SAMPLE_DATA/Big Class.jmp");

dt_main = dt_raw &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; Graph Builder(
	Size(658, 550),
	Show Control Panel(0),
	Variables(X(:age), Y(:height)),
	Elements(Points(X, Y, Legend(4)))
);

ldf = gb &amp;lt;&amp;lt; Local Data Filter(
	Close Outline(1),
	Add Filter(columns(:age), Display(:age, N Items(6)))
);

f = Function({a},
	selrows = dt_main &amp;lt;&amp;lt; Get Selected Rows;
	selvals = As List(dt_main[selrows, "age"]); // drop unique if necessary
		
	ldf &amp;lt;&amp;lt; (Filter Column(:age) &amp;lt;&amp;lt; Where(:age == selvals));
);

rs = dt_main &amp;lt;&amp;lt; Make RowState Handler(f);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There might be (much) better options than using row state handler but it is impossible to tell with the information provided.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2026 18:31:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Local-data-filter-update-by-another-data-table/m-p/954903#M110050</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2026-06-22T18:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Local data filter update by another data table</title>
      <link>https://community.jmp.com/t5/Discussions/Local-data-filter-update-by-another-data-table/m-p/955058#M110056</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Heres a bit more detail code, the whole thing, theres nothing sensitive in it. &lt;BR /&gt;&lt;BR /&gt;I tested the proposed solution but it does nothing to the filter. Removing the where clausule had the effect that it made many more filters but what I want to do is change the filtered values.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I made a dummy proto where I delete the filter and create a new one but that is laggy.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Anything more sophisticated is welcome :)&lt;/img&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;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 ) &amp;lt;&amp;lt; Get Name ), 1 ),
    
    dtDetail &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; Make RowState Handler(f);
 
Update Detail Filter = Function( {},
    
    {selRows, selectedSources, i, r, sf, detailRows},
 
    selectedSources = {};
 
    
    selectedRows = dtMaster &amp;lt;&amp;lt; Get Row States;
    
    
    filteredKeys = dtMaster:SourceFile[Loc(selectedRows)];
filteredKeys = Associative Array( filteredKeys ) &amp;lt;&amp;lt; Get Keys;
 
 
   
 
 
 
detailFilter &amp;lt;&amp;lt; (
Filter Column( :SourceFile ) &amp;lt;&amp;lt;
Where(
:SourceFile == "filteredKeys" // Not performing anything
)
);
 
        
 
    
);
 
 
/*
    CREATE MASTER PLOT
    Selection in this plot drives the second plot.
*/
 
masterPlot = dtMaster &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; 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 &amp;lt;&amp;lt; Make Row State Handler(
    Function( {changedRows},
        Update Detail Filter();
    )
);
 
 
/*
    Initial update
*/
 
Update Detail Filter();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;SPAN&gt;txnelson edit: moved to JSL block&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;-Ilmari (we used to work in the same company)&lt;/DIV&gt;</description>
      <pubDate>Tue, 23 Jun 2026 16:16:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Local-data-filter-update-by-another-data-table/m-p/955058#M110056</guid>
      <dc:creator>UnrelatedLamb77</dc:creator>
      <dc:date>2026-06-23T16:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Local data filter update by another data table</title>
      <link>https://community.jmp.com/t5/Discussions/Local-data-filter-update-by-another-data-table/m-p/955059#M110057</link>
      <description>&lt;P&gt;Nvm Jarmo I figured it out, your solution worked&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2026 11:29:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Local-data-filter-update-by-another-data-table/m-p/955059#M110057</guid>
      <dc:creator>UnrelatedLamb77</dc:creator>
      <dc:date>2026-06-23T11:29:19Z</dc:date>
    </item>
  </channel>
</rss>

