<?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: Filter Change Handler in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Filter-Change-Handler/m-p/663702#M85215</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4587"&gt;@danschikore&lt;/a&gt;, thank you for the reply.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I noticed that a Data Filter which is opened from a Graph Builder object always triggers the function twice - while a Data filter in a Data Filter Context Box just triggers the function 1x.&lt;BR /&gt;&lt;BR /&gt;And if you disable the&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;count excluded rows&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;of the "inner" Data Filter then you can watch some ping-pong between both data filters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the reason for the function calls with return value 0?&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" );
countexcluded = 1;

New Window( "Big Class - Dashboard",
	Data Filter Context Box(
		Panel Box( "Data Filter Context Box: Data Filter + GraphBuilder",
			H Splitter Box(
				Size( 700, 400 ),
				&amp;lt;&amp;lt;Sizes( {0.3, 0.7} ), 

				dt &amp;lt;&amp;lt; Data Filter( Local, Add Filter( columns( :sex ) ) ),
				Panel Box( "Graph builder + local data fitler",
					V List Box(
						Button Box( "toggle count excluded",
							countexcluded = Not( countexcluded );
							(Current Report()[Panel Box( 2 )]["Local Data Filter"] &amp;lt;&amp;lt; get scriptable object()) &amp;lt;&amp;lt;
							count excluded rows( countexcluded );
						),
						gb = dt &amp;lt;&amp;lt; Graph Builder(
							Size( 211, 211 ),
							Show Control Panel( 0 ),
							Fit to Window,
							Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
							Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
							Local Data Filter( Add Filter( columns( :age ) ) )
						)
					)
				)
			)
		)
	)
);

dfs = (Current Report() &amp;lt;&amp;lt; XPath( "//OutlineBox[text()='Local Data Filter']" )) &amp;lt;&amp;lt; get scriptable object();

f1 = Function( {a}, write("outer: ",  a,"\!n" ) );
f2 = Function( {a}, write("inner: ",  a,"\!n" ) );


rs1 = dfs[1] &amp;lt;&amp;lt; Make Filter Change Handler( f1 );
rs2 = dfs[2] &amp;lt;&amp;lt; Make Filter Change Handler( f2 );


&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 29 Jul 2023 14:41:28 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2023-07-29T14:41:28Z</dc:date>
    <item>
      <title>Filter Change Handler</title>
      <link>https://community.jmp.com/t5/Discussions/Filter-Change-Handler/m-p/663692#M85213</link>
      <description>&lt;P&gt;I just found out:&amp;nbsp;&lt;STRONG&gt;Make Filter Change handler&lt;/STRONG&gt; only works if I store the return value in a variable.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Why does&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;filter &amp;lt;&amp;lt; Make Filter Change Handler( f );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;not work? Is there some knowledge behind it that is worth knowing?&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/Cities.jmp" );
dist = Distribution( Automatic Recalc( 1 ), Continuous Distribution( Column( :POP ) ) );
filter = dist &amp;lt;&amp;lt; Local Data Filter( Add Filter( columns( :Region ) ) );
f = Function( {a}, Print( a ) );
// 1st version dosn't work - why?
// filter &amp;lt;&amp;lt; Make Filter Change Handler( f );
rs = filter &amp;lt;&amp;lt; Make Filter Change Handler( f );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Jul 2023 14:14:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Filter-Change-Handler/m-p/663692#M85213</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-07-29T14:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Change Handler</title>
      <link>https://community.jmp.com/t5/Discussions/Filter-Change-Handler/m-p/663699#M85214</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26800"&gt;@hogi&lt;/a&gt;&amp;nbsp;- this just came up with someone else recently.&amp;nbsp; The reason behind the current behavior is that the JSL symbol is the owner of the object that dispatches the callbacks. Unlike platforms that create a window, there is not another clear candidate to take ownership.&amp;nbsp; This also happens with things like display boxes if you create a box but do not give it a parent or store it to a symbol, it's just less noticeable in that case.&amp;nbsp; One option would be to put the variable into a window-scope symbol so that it will go away with the report.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jul 2023 14:31:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Filter-Change-Handler/m-p/663699#M85214</guid>
      <dc:creator>danschikore</dc:creator>
      <dc:date>2023-07-29T14:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Change Handler</title>
      <link>https://community.jmp.com/t5/Discussions/Filter-Change-Handler/m-p/663702#M85215</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4587"&gt;@danschikore&lt;/a&gt;, thank you for the reply.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I noticed that a Data Filter which is opened from a Graph Builder object always triggers the function twice - while a Data filter in a Data Filter Context Box just triggers the function 1x.&lt;BR /&gt;&lt;BR /&gt;And if you disable the&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;count excluded rows&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;of the "inner" Data Filter then you can watch some ping-pong between both data filters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the reason for the function calls with return value 0?&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" );
countexcluded = 1;

New Window( "Big Class - Dashboard",
	Data Filter Context Box(
		Panel Box( "Data Filter Context Box: Data Filter + GraphBuilder",
			H Splitter Box(
				Size( 700, 400 ),
				&amp;lt;&amp;lt;Sizes( {0.3, 0.7} ), 

				dt &amp;lt;&amp;lt; Data Filter( Local, Add Filter( columns( :sex ) ) ),
				Panel Box( "Graph builder + local data fitler",
					V List Box(
						Button Box( "toggle count excluded",
							countexcluded = Not( countexcluded );
							(Current Report()[Panel Box( 2 )]["Local Data Filter"] &amp;lt;&amp;lt; get scriptable object()) &amp;lt;&amp;lt;
							count excluded rows( countexcluded );
						),
						gb = dt &amp;lt;&amp;lt; Graph Builder(
							Size( 211, 211 ),
							Show Control Panel( 0 ),
							Fit to Window,
							Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
							Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
							Local Data Filter( Add Filter( columns( :age ) ) )
						)
					)
				)
			)
		)
	)
);

dfs = (Current Report() &amp;lt;&amp;lt; XPath( "//OutlineBox[text()='Local Data Filter']" )) &amp;lt;&amp;lt; get scriptable object();

f1 = Function( {a}, write("outer: ",  a,"\!n" ) );
f2 = Function( {a}, write("inner: ",  a,"\!n" ) );


rs1 = dfs[1] &amp;lt;&amp;lt; Make Filter Change Handler( f1 );
rs2 = dfs[2] &amp;lt;&amp;lt; Make Filter Change Handler( f2 );


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Jul 2023 14:41:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Filter-Change-Handler/m-p/663702#M85215</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-07-29T14:41:28Z</dc:date>
    </item>
  </channel>
</rss>

