<?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: How do write a JSL that implements one of the conditions for selecting a subset using cell values? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-write-a-JSL-that-implements-one-of-the-conditions-for/m-p/399178#M64996</link>
    <description>&lt;P class="_tgt transPara grammarSection"&gt;&lt;SPAN class="transSent"&gt;This code uses the contents of the cell directly to calculate the values in the column formula.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="_tgt transPara grammarSection"&gt;&lt;SPAN class="transSent"&gt;But I don't know how to apply this form to code that selects subsets.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="_tgt transPara grammarSection"&gt;&lt;SPAN class="transSent"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="_tgt transPara grammarSection"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aaa = dt[r, "abc"];

Eval( Parse( "Column(d9,\!"test\!")&amp;lt;&amp;lt;Formula(" || aaa || ")" ) );

d9 &amp;lt;&amp;lt; run formulas;
Column( "test" ) &amp;lt;&amp;lt; deleteFormula;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 07 Jul 2021 08:56:55 GMT</pubDate>
    <dc:creator>lwx228</dc:creator>
    <dc:date>2021-07-07T08:56:55Z</dc:date>
    <item>
      <title>How do write a JSL that implements one of the conditions for selecting a subset using cell values?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-write-a-JSL-that-implements-one-of-the-conditions-for/m-p/399159#M64993</link>
      <description>&lt;P&gt;For example, in "Big Class.jmp": add" add" column,And change the value of the first row of the "add" column to "&amp;amp;:height&amp;lt;65". How do code JSL to add the condition in the first row of the "add" column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Make the JSL function of this combination the same as that of the following code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt &amp;lt;&amp;lt; Select Where( sex == "F" &amp;amp; :age &amp;gt; 14 &amp;amp; :height &amp;lt; 65 );
d3 = dt &amp;lt;&amp;lt; Subset( Output Table( "test" ), Selected Rows( 1 ), selected columns( 0 ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-07-07_163759.png" style="width: 653px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/34008iFD23E2359790C114/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-07-07_163759.png" alt="2021-07-07_163759.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:51:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-write-a-JSL-that-implements-one-of-the-conditions-for/m-p/399159#M64993</guid>
      <dc:creator>lwx228</dc:creator>
      <dc:date>2023-06-09T19:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do write a JSL that implements one of the conditions for selecting a subset using cell values?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-write-a-JSL-that-implements-one-of-the-conditions-for/m-p/399173#M64994</link>
      <description>&lt;P&gt;I tried to code this way, but it didn't work.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Column( "add", Character, "Nominal" );
dt[1, "add"] = "&amp;amp;:height&amp;lt;65";
a = dt[1, "add"];
dt &amp;lt;&amp;lt; Select Where( :sex == "F" &amp;amp; :age &amp;gt; 14 || a );
d3 = dt &amp;lt;&amp;lt; Subset( Output Table( "test" ), Selected Rows( 1 ), selected columns( 0 ) );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know how to code this form of selection of subsets using the values of cells as conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Experts!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 08:51:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-write-a-JSL-that-implements-one-of-the-conditions-for/m-p/399173#M64994</guid>
      <dc:creator>lwx228</dc:creator>
      <dc:date>2021-07-07T08:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do write a JSL that implements one of the conditions for selecting a subset using cell values?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-write-a-JSL-that-implements-one-of-the-conditions-for/m-p/399178#M64996</link>
      <description>&lt;P class="_tgt transPara grammarSection"&gt;&lt;SPAN class="transSent"&gt;This code uses the contents of the cell directly to calculate the values in the column formula.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="_tgt transPara grammarSection"&gt;&lt;SPAN class="transSent"&gt;But I don't know how to apply this form to code that selects subsets.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="_tgt transPara grammarSection"&gt;&lt;SPAN class="transSent"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="_tgt transPara grammarSection"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;aaa = dt[r, "abc"];

Eval( Parse( "Column(d9,\!"test\!")&amp;lt;&amp;lt;Formula(" || aaa || ")" ) );

d9 &amp;lt;&amp;lt; run formulas;
Column( "test" ) &amp;lt;&amp;lt; deleteFormula;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Jul 2021 08:56:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-write-a-JSL-that-implements-one-of-the-conditions-for/m-p/399178#M64996</guid>
      <dc:creator>lwx228</dc:creator>
      <dc:date>2021-07-07T08:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do write a JSL that implements one of the conditions for selecting a subset using cell values?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-write-a-JSL-that-implements-one-of-the-conditions-for/m-p/399361#M65022</link>
      <description>&lt;P&gt;This is definitely possible, but have you ruled out using a (global) data filter? This would let you--and those who are not scripters--enter queries easily, saving your favorites, and saving the filter off to the data table for future use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once favorites exist, they are easily accessible from a drop-down menu.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a really easy way to go (and to teach to your script-averse co-workers, who may be the end-users?). The cell-based approach will require end-users to enter legitimate syntax--far from guaranteed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you've set this up, the users just need to pick from a drop-down. More advanced users can add their own filters. Selections are made immediately, so all that remains is actually creating the subset.&lt;/P&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="brady_brady_0-1625678810086.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/34024iD720504A86F51594/image-size/large?v=v2&amp;amp;px=999" role="button" title="brady_brady_0-1625678810086.png" alt="brady_brady_0-1625678810086.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If, on the other hand, you need to stick with your initial approach, here is a way to do it:&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);

//setup
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt &amp;lt;&amp;lt; new column("add");
dt:add[1] = " &amp;amp; :height &amp;lt; 65";

//using \[ and ]\ to delimit the initial :sex == "F" string means you don't have to escape double-quotes.
query text = "\[:sex == "F"]\" || dt:add[1];

//parse and substitute the actual query text in for _TXT_ in the first expression below, and evaluate
eval (substitute( 
	expr ( dt &amp;lt;&amp;lt; Select Where( _TXT_ ) ),
	expr( _TXT_),
	parse(query text)
));

dtSub = dt &amp;lt;&amp;lt; subset (selected rows(1), selected columns(0));

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Brady&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 17:41:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-write-a-JSL-that-implements-one-of-the-conditions-for/m-p/399361#M65022</guid>
      <dc:creator>brady_brady</dc:creator>
      <dc:date>2021-07-07T17:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do write a JSL that implements one of the conditions for selecting a subset using cell values?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-write-a-JSL-that-implements-one-of-the-conditions-for/m-p/399500#M65042</link>
      <description>Thank brady!&lt;BR /&gt;&lt;BR /&gt;This is exactly the JSL I need so that I don't need to use if().</description>
      <pubDate>Thu, 08 Jul 2021 00:22:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-write-a-JSL-that-implements-one-of-the-conditions-for/m-p/399500#M65042</guid>
      <dc:creator>lwx228</dc:creator>
      <dc:date>2021-07-08T00:22:24Z</dc:date>
    </item>
  </channel>
</rss>

