<?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: Connect Local Data Filters between Graph Builder Windows from different data tables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664976#M85342</link>
    <description>&lt;P&gt;I like the idea, but obviously there's something I don't understand in your solution, as it crashes when I try to run it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

gb1 = dt &amp;lt;&amp;lt; Graph Builder(
	Graph Spacing( 5 ),
	Variables( X( :sex ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 5 ) ) )
);

gb2 = dt &amp;lt;&amp;lt; Graph Builder(
	Graph Spacing( 5 ),
	Variables( X( :sex ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 5 ) ) )
);

df1 = gb1 &amp;lt;&amp;lt;  Local Data Filter(
	Add Filter(
		columns( :sex ),
		Where( :sex == "M" ),
		Display( :sex, N Items( 2 ) )
	)
);

df2 = gb2 &amp;lt;&amp;lt;  Local Data Filter(
	Add Filter(
		columns( :sex ),
		Where( :sex == "F" ),
		Display( :sex, N Items( 2 ) )
	)
);


broadcastFilter = Function( {}, 
//get the script
	filterScript = df1 &amp;lt;&amp;lt; get Script();
//search for the "Add filter" part
	For( i = 1, i &amp;lt;= N Arg( filterScript ), i++,
		If( Head( Arg( filterScript, i ) ) == Expr( Add Filter() ),
			filterExpression = Arg( filterScript, i )
		)
	);
// broadcast it to the other Data filter
	Eval(
		Substitute(
				Expr(
					df2 &amp;lt;&amp;lt; Start Over &amp;lt;&amp;lt; _filter_
				),
			Expr( _filter_ ), Name Expr( filterExpression )
		)
	);
);		

// activate the Filter Change Handler
rs = df1 &amp;lt;&amp;lt; Make Filter Change Handler( broadcastFilter );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here's the error:&amp;nbsp; "broadcastFilter has 0 parameters () but 1 arguments (18) were supplied".&amp;nbsp; Any idea what it's talking about?&amp;nbsp; I don't think I'm supplying any arguments in that last line...&lt;/P&gt;</description>
    <pubDate>Thu, 03 Aug 2023 04:25:01 GMT</pubDate>
    <dc:creator>BHarris</dc:creator>
    <dc:date>2023-08-03T04:25:01Z</dc:date>
    <item>
      <title>Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664430#M85279</link>
      <description>&lt;P&gt;Suppose I have two Graph Builder windows from different data tables, each with a Local Data Filter filtering on "run number" and "time".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to connect the two Local Data Filters so they stay in sync?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or perhaps with JSL to pull the current settings from Local Data Filter #1 and apply them to Local Data Filter #2?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I guess step 1 is getting a reference to the Local Data Filters, I haven't even figured out how to do that yet -- here's what I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// get the last Graph Builder
win = Get Window List();
graphs = Filter Each({w}, win,
	If(Length(w &amp;lt;&amp;lt; XPath("//OutlineBox[@helpKey='Graph Builder']")) &amp;gt; 0, 1, 0)
);
last_gb = graphs[N Items(graphs)][OutlineBox("Graph Builder")] &amp;lt;&amp;lt; Get Scriptable Object;
localDataFilter = last_gb &amp;lt;&amp;lt; XPath("//OutlineBox[text()='Local Data Filter']");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 15:26:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664430#M85279</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2023-08-01T15:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664437#M85280</link>
      <description>&lt;P&gt;Could you concatenate the tables together and then use some sort of grouping column to separate them to different graphs? It might be easier than messing with filter change handler(s).&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 15:37:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664437#M85280</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-08-01T15:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664543#M85295</link>
      <description>&lt;P&gt;Not really -- one table is a high-level summary of the run results, and we identify problems from that summary, then switch to the detailed-run plot and select the specific run in the data filter.&amp;nbsp; It's not obvious to me how merging those two tables would enable that type of behavior.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 17:32:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664543#M85295</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2023-08-01T17:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664676#M85315</link>
      <description>&lt;P&gt;How about virtual joins?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 08:07:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664676#M85315</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-08-02T08:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664792#M85322</link>
      <description>&lt;P&gt;similar post:&lt;BR /&gt;&lt;A href="https://community.jmp.com/t5/Discussions/Virtual-linking-two-tables-via-JSL-scripting/m-p/657682/highlight/true#M84705" target="_blank"&gt;https://community.jmp.com/t5/Discussions/Virtual-linking-two-tables-via-JSL-scripting/m-p/657682/highlight/true#M84705&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 17:00:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664792#M85322</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-08-02T17:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664802#M85324</link>
      <description>&lt;P&gt;I guess one needs not-local data filters such that the Dispatch/Receive functionality of virtual links will broadcast the filter settings.&lt;/P&gt;&lt;P&gt;For my case, this was too slow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 17:04:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664802#M85324</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-08-02T17:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664805#M85325</link>
      <description>&lt;P&gt;At the end, I switched back to local data filters and added a Filter Change Handler to the first Data Filter.&lt;BR /&gt;It works quite well - If you don't forget the&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;rs=&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;LI-MESSAGE title="Filter Change Handler" uid="663692" url="https://community.jmp.com/t5/Discussions/Filter-Change-Handler/m-p/663692#U663692" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;broadcastFilter=Function({x}, // Make Filter Change Handler need a function with 1 Argument
//get the script
filterScript = DataFilter1 &amp;lt;&amp;lt; get Script();
//search for the "Add filter" part
		For( i = 1, i &amp;lt;= N Arg( filterScript ), i++,
			If( Head( Arg( filterScript, i ) ) == Expr( Add Filter() ),
				filterExpression = Arg( filterScript, i )
			)
		);
// broadcast it to the other Data filter
Eval( Substitute( Expr( Datafilter2 &amp;lt;&amp;lt; Start Over &amp;lt;&amp;lt; _filter_ ), Expr( _filter_ ), 
Name Expr( filterExpression ) ) );		

// activate the Filter Change Handler
rs = DataFilter1 &amp;lt;&amp;lt; Make Filter Change Handler( broadcastFilter);&amp;nbsp;//&amp;nbsp;will&amp;nbsp;call&amp;nbsp;broadcastFilter()&amp;nbsp;with 1&amp;nbsp;Argument:&amp;nbsp;# of selected rows&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;edit:argument x added and commented. A Function&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;broadcastFilter=Function({},&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;-without arguments - doesn't work.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 06:24:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664805#M85325</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-08-03T06:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664833#M85326</link>
      <description>&lt;P&gt;And if you want to copy the whole filter, you could use copy/paste:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb1 = dt &amp;lt;&amp;lt; Graph Builder(
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);

gb2 = dt &amp;lt;&amp;lt; Graph Builder(
	Show Control Panel( 0 ),
	Variables( X( :sex ), X( :age, Position( 1 ) ), Y( :weight ), Overlay( :sex ) ),
	Elements( Bar( X( 1 ), X( 2 ), Y, Legend( 3 ) ) )
);

df1 = gb1 &amp;lt;&amp;lt;  Local Data Filter(
	Add Filter(
		columns( :age ),
		Where( :age == 15 ),
		Display( :age, N Items( 6 ) )
	)
);

df1 &amp;lt;&amp;lt; copy local data filter();

gb2 &amp;lt;&amp;lt; paste local data filter();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Aug 2023 17:45:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664833#M85326</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-08-02T17:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664976#M85342</link>
      <description>&lt;P&gt;I like the idea, but obviously there's something I don't understand in your solution, as it crashes when I try to run it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

gb1 = dt &amp;lt;&amp;lt; Graph Builder(
	Graph Spacing( 5 ),
	Variables( X( :sex ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 5 ) ) )
);

gb2 = dt &amp;lt;&amp;lt; Graph Builder(
	Graph Spacing( 5 ),
	Variables( X( :sex ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 5 ) ) )
);

df1 = gb1 &amp;lt;&amp;lt;  Local Data Filter(
	Add Filter(
		columns( :sex ),
		Where( :sex == "M" ),
		Display( :sex, N Items( 2 ) )
	)
);

df2 = gb2 &amp;lt;&amp;lt;  Local Data Filter(
	Add Filter(
		columns( :sex ),
		Where( :sex == "F" ),
		Display( :sex, N Items( 2 ) )
	)
);


broadcastFilter = Function( {}, 
//get the script
	filterScript = df1 &amp;lt;&amp;lt; get Script();
//search for the "Add filter" part
	For( i = 1, i &amp;lt;= N Arg( filterScript ), i++,
		If( Head( Arg( filterScript, i ) ) == Expr( Add Filter() ),
			filterExpression = Arg( filterScript, i )
		)
	);
// broadcast it to the other Data filter
	Eval(
		Substitute(
				Expr(
					df2 &amp;lt;&amp;lt; Start Over &amp;lt;&amp;lt; _filter_
				),
			Expr( _filter_ ), Name Expr( filterExpression )
		)
	);
);		

// activate the Filter Change Handler
rs = df1 &amp;lt;&amp;lt; Make Filter Change Handler( broadcastFilter );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here's the error:&amp;nbsp; "broadcastFilter has 0 parameters () but 1 arguments (18) were supplied".&amp;nbsp; Any idea what it's talking about?&amp;nbsp; I don't think I'm supplying any arguments in that last line...&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 04:25:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664976#M85342</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2023-08-03T04:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664997#M85345</link>
      <description>&lt;P&gt;Oh. sorry.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;broadcastFilter = Function( {x}, &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Aug 2023 06:21:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/664997#M85345</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-08-03T06:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/665223#M85357</link>
      <description>&lt;P&gt;Wow, it works!&amp;nbsp; I wish I understood what that code was doing...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Last question -- assuming I already have a Graph Builder window open with a Local Data Filter, I know how I can get the gb .jsl object variable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;win = Get Window List();
graphs = Filter Each({w}, win,	If(Length(w &amp;lt;&amp;lt; XPath("//OutlineBox[@helpKey='Graph Builder']")) &amp;gt; 0, 1, 0) );
gb = graphs[N Items(graphs)][OutlineBox("Graph Builder")] &amp;lt;&amp;lt; Get Scriptable Object;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;... but how can I get the df1 object variable from the gb object variable?&amp;nbsp; (It feels like I've tried 100 different things...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 15:11:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/665223#M85357</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2023-08-03T15:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Connect Local Data Filters between Graph Builder Windows from different data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/665230#M85358</link>
      <description>&lt;P&gt;One option is to use similar idea as you use for graph builder&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;df = (gb &amp;lt;&amp;lt; top parent)[Outline Box("Local Data Filter")] &amp;lt;&amp;lt; Get Scriptable Object;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;local data filter isn't inside the graph builder, so you have to first travel to higher level (in this case I use &amp;lt;&amp;lt; top parent). Using XPath with attribute helpKey and value Data Filter might be a bit more robust solution and it would be something like this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;(gb &amp;lt;&amp;lt; top parent) &amp;lt;&amp;lt; XPath("//OutlineBox[@helpKey='Data Filter']")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: If you have possibility of multiple data filters in the same window, you might have to make the definition of the starting point a bit more specific than just using &amp;lt;&amp;lt; top parent.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 15:41:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Connect-Local-Data-Filters-between-Graph-Builder-Windows-from/m-p/665230#M85358</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-08-03T15:41:38Z</dc:date>
    </item>
  </channel>
</rss>

