<?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: JSL Adding &amp;quot;And&amp;quot; condition to Data Filter in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827088#M100850</link>
    <description>&lt;P&gt;Make sure you add to the JMP Wish List this exposed limitation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I guess I have a different take on your mentioned parse and evaluate.&amp;nbsp; It gives me comfort that if I come up against a limitation JMP provides this base level capability that most times allows me a path to solution.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jan 2025 13:30:49 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2025-01-13T13:30:49Z</dc:date>
    <item>
      <title>JSL Adding "And" condition to Data Filter</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/826618#M100775</link>
      <description>&lt;P&gt;Hello JMP Community&lt;/P&gt;&lt;P&gt;I was wondering if there is a way to add an "and" condition to a data filter in JSL.&lt;/P&gt;&lt;P&gt;as an example I made a dataset&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KasperSchlosser_0-1736509450304.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71795iFC8C111A755CDEE5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KasperSchlosser_0-1736509450304.png" alt="KasperSchlosser_0-1736509450304.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If we make a simple model over just the mean,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;model = Fit Model( Y( :Data ), Run);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;We can restrict the model to just one group with a data filter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtf = model &amp;lt;&amp;lt; Local Data Filter(Columns(:Group), where(:Group == "A"));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KasperSchlosser_1-1736509990229.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71797iB29C4091F95D3485/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KasperSchlosser_1-1736509990229.png" alt="KasperSchlosser_1-1736509990229.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However now if I want to add another filter the only JSL options i could find( "Add Filter", "Filter Columns", and similar) only seems to add as an "Or" condition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtf &amp;lt;&amp;lt; Add Filter(columns(:Outlier), where(:outlier == 0));
dtf &amp;lt;&amp;lt; Filter Columns(:Outlier);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KasperSchlosser_2-1736510260196.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71798i846803CA6037D73C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KasperSchlosser_2-1736510260196.png" alt="KasperSchlosser_2-1736510260196.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The only option seem to be to remove the data filter, then add a new filter with all the conditions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;model &amp;lt;&amp;lt; Remove Local Data Filter;
dtf = model &amp;lt;&amp;lt; Local Data Filter(Columns(:Group, :Outlier), where(:Group == "A"), where(Outlier == 0));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KasperSchlosser_3-1736510582974.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71799iB1FC77F981C2E933/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KasperSchlosser_3-1736510582974.png" alt="KasperSchlosser_3-1736510582974.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Am i missing a way to add "And" conditions or is this just not possible.&lt;/P&gt;&lt;P&gt;br.&lt;/P&gt;&lt;P&gt;Kasper Schlosser&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 12:14:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/826618#M100775</guid>
      <dc:creator>KasperSchlosser</dc:creator>
      <dc:date>2025-01-10T12:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Adding "And" condition to Data Filter</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/826641#M100778</link>
      <description>&lt;P&gt;Create the filter in JMP and copy the script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Fit Model(
	Y(:Data),
	Effects,
	Personality("Standard Least Squares"),
	Emphasis("Effect Leverage"),
	Run(
		:Data &amp;lt;&amp;lt; {Summary of Fit(1), Analysis of Variance(1), Parameter Estimates(1),
		Lack of Fit(0), Plot Actual by Predicted(1), Plot Regression(0),
		Plot Residual by Predicted(1), Plot Studentized Residuals(0),
		Plot Effect Leverage(1), Plot Residual by Normal Quantiles(0),
		Box Cox Y Transformation(0)}
	),
	Local Data Filter(
		Add Filter(
			columns(:Group, :Outlier),
			Where(:Group == "A"),
			Where(:Outlier == 1)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This generally gives a good idea what you can then script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();

model = Fit Model(Y(:Data), Run);

dtf = model &amp;lt;&amp;lt; Local Data Filter(
	Columns(:Group, :Outlier),
	Where(:Group == "A"),
	Where(:Outlier == 1)
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Jan 2025 12:36:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/826641#M100778</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-01-10T12:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Adding "And" condition to Data Filter</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827051#M100845</link>
      <description>&lt;P&gt;Yes or the scripting index also gives an overview of what messages the a data filter accepts (though not always all).&lt;/P&gt;&lt;P&gt;Both of these seem to indicate that no, there is no way to add a "and" condition to a data filter through jsl.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This would mean the only way to add an "and" condition is in jsl is to extract the filter code, change the code, then parse and evaluate. which is messy and error prone.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 09:49:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827051#M100845</guid>
      <dc:creator>KasperSchlosser</dc:creator>
      <dc:date>2025-01-13T09:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Adding "And" condition to Data Filter</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827088#M100850</link>
      <description>&lt;P&gt;Make sure you add to the JMP Wish List this exposed limitation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I guess I have a different take on your mentioned parse and evaluate.&amp;nbsp; It gives me comfort that if I come up against a limitation JMP provides this base level capability that most times allows me a path to solution.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 13:30:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827088#M100850</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-01-13T13:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Adding "And" condition to Data Filter</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827155#M100859</link>
      <description>&lt;P&gt;When you add new columns to filters, you are basically creating new filtering groups and by default those are OR separated. Depending on the use case, sometimes you might be able to use Grouped by And&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Cities.jmp");
obj = dt &amp;lt;&amp;lt; Data Filter(
	Add Filter(columns(:Region, :POP), Where(:Region == {"C", "N"})),
	Mode(Select(0), Show(0), Include(1))
);
obj &amp;lt;&amp;lt; Add Filter Columns(:State);
obj &amp;lt;&amp;lt; Grouped by AND(1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;On the UI we have Add to Selected Group when you press AND but we do not have simple scripting option for that.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 18:53:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827155#M100859</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-01-13T18:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Adding "And" condition to Data Filter</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827209#M100868</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;but we do not have simple scripting option for that.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I think we do have:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
gb = dt &amp;lt;&amp;lt; Graph builder();

dtf = gb &amp;lt;&amp;lt; Local Data Filter(
	Columns(:sex),
	Where(:sex == "F")
);

dtf &amp;lt;&amp;lt; (Filter Column(:age) &amp;lt;&amp;lt; Where(:age == 14));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jan 2025 20:41:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827209#M100868</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-01-13T20:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Adding "And" condition to Data Filter</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827284#M100882</link>
      <description>&lt;P&gt;This seems to work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quick testing indicates, this method&amp;nbsp; affects the first filter. ie. if we have 2 "or" conditions we can only affect the first one.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
gb = dt &amp;lt;&amp;lt; Graph builder();

dtf = gb &amp;lt;&amp;lt; Local Data Filter(
	Columns(:sex),
	Where(:sex == "F")
);

// adds or condition
dtf &amp;lt;&amp;lt; Add Filter(Columns(:sex), Where(:sex == "M"))

// Only affects the female filter
dtf &amp;lt;&amp;lt; (Filter Column(:age) &amp;lt;&amp;lt; Where(:age == 14));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but for my use case this is perfect.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 09:07:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827284#M100882</guid>
      <dc:creator>KasperSchlosser</dc:creator>
      <dc:date>2025-01-14T09:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Adding "And" condition to Data Filter</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827286#M100883</link>
      <description>&lt;P&gt;Nice find!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This seems to work only if you also send the where message with the filter column. This might be unintended / bug or something but we are lucky we have it (it just might break any given time when JMP gets updated).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Cities.jmp");
obj = dt &amp;lt;&amp;lt; Data Filter(
	Add Filter(
		columns(:Region, :POP),
		Where(:Region == {"C", "N"})
	),
	Mode(Select(0), Show(0), Include(1))
);

obj &amp;lt;&amp;lt; Filter Column(:State); // creates OR group
obj &amp;lt;&amp;lt; (Filter Column(:State) &amp;lt;&amp;lt; Where()); // Adds AND filter to first filter group
obj &amp;lt;&amp;lt; (Filter Column(:CO) &amp;lt;&amp;lt; Where()); // Adds AND filter to first filter group&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most likely it would be much better if we were somehow able to just add AND filter within existing groups and not just new filter OR groups.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt; any idea why this is happening / any idea who to tag from JMP's side?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 09:30:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827286#M100883</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-01-14T09:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: JSL Adding "And" condition to Data Filter</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827334#M100893</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;pointed out earlier, filters are composed of "groups" and "items", and the filter group is not directly exposed to JSL as a scriptable object.&amp;nbsp; The syntax &lt;FONT face="courier new,courier"&gt;df &amp;lt;&amp;lt; (Filter Column(:col) &amp;lt;&amp;lt; Msg())&lt;/FONT&gt;&amp;nbsp;was the original way to "forward" messages to a group, though it is not well documented.&amp;nbsp; I will point out that this syntax is a &lt;STRONG&gt;very&lt;/STRONG&gt; different path than the simple message df &amp;lt;&amp;lt; Filter Column(:col), which &lt;STRONG&gt;is&lt;/STRONG&gt; documented in the Scripting Index.&amp;nbsp; The former syntax does not have built-in JSL rules for processing, though it is used in similar ways in other objects, like Bivariate.&amp;nbsp; Essentially, the message being sent to the filter is an expression, and the syntax supported is custom to the filter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A little more on the special syntax for forwarding the messages.&amp;nbsp; There is an optional second argument to specify the index of the filter group that should receive the message.&amp;nbsp; This can be important when you have multiple groups, which might even contain the same columns.&amp;nbsp; Without this, the command will be sent to the first matching column, or added to the first group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may also find that the &lt;FONT face="courier new,courier"&gt;Msg()&lt;/FONT&gt; being sent to the filter item can only be a simple message.&amp;nbsp; The processing here does not support sending a list of commands to be processed.&amp;nbsp; This is again due to the inner &lt;FONT face="courier new,courier"&gt;&amp;lt;&amp;lt;&lt;/FONT&gt; being a custom execution and not directly using the core JSL rules.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Cities.jmp" );
df = dt &amp;lt;&amp;lt; Data Filter(
	Location( {1001, 218} ),
	Add Filter( columns( :POP ), Where( :POP &amp;gt;= 4461 ) ),
	Add Filter( columns( :OZONE ), Where( :OZONE &amp;lt;= 0.12581 ) )
);
// add a filter item to the first group
df &amp;lt;&amp;lt; (Filter Column(:Region, 1) &amp;lt;&amp;lt; Check Box Display);
// add a filter item to the second group
df &amp;lt;&amp;lt; (Filter Column(:NO, 2) &amp;lt;&amp;lt; Where(:NO &amp;lt;= 0.05));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 15:40:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Adding-quot-And-quot-condition-to-Data-Filter/m-p/827334#M100893</guid>
      <dc:creator>danschikore</dc:creator>
      <dc:date>2025-01-14T15:40:07Z</dc:date>
    </item>
  </channel>
</rss>

