<?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 script to filter out entire rows where a particular column contain missing values in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-script-to-filter-out-entire-rows-where-a-particular-column/m-p/738280#M91962</link>
    <description>&lt;P&gt;Hi Michal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The cool thing in JMP: jou don't have to know any scripting, you can just use the GUI and your mouse.&lt;/P&gt;&lt;P&gt;Then after executing the steps, you can go to the advanced log and check the code ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Rows/ Row Selection/ Select Where (Ctrl + W)&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1711227829155.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62562iA74866BDE580AFB1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1711227829155.png" alt="hogi_0-1711227829155.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;open data view for selected rows:&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1711227878188.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62563i1F55DCB8D620107E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1711227878188.png" alt="hogi_1-1711227878188.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;-&amp;nbsp; check the log:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_2-1711227951991.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62564i4B969896812FBD55/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_2-1711227951991.png" alt="hogi_2-1711227951991.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jmp understands what you want - and even combines the two steps to a single line of code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_3-1711229543223.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62565i8739E012798309CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_3-1711229543223.png" alt="hogi_3-1711229543223.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to construct the command on your own, you can define some strings, concatenate them and then parse and evaluate the final code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cond1 = "Is Missing( :age )";
cond2 = ":age &amp;gt; 16";

Eval(Parse("dt &amp;lt;&amp;lt; Select where( "|| cond1 || " | " || cond2 || " ) &amp;lt;&amp;lt; Data View;"))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My suggestion: invest some time to learn and understand&amp;nbsp;&lt;STRONG&gt;Expression Handling&lt;BR /&gt;A great tutorial:&amp;nbsp;&lt;LI-MESSAGE title="Using JSL to Develop Efficient, Robust Applications (EU 2018 415)" uid="51456" url="https://community.jmp.com/t5/Discovery-Summit-Europe-2018/Using-JSL-to-Develop-Efficient-Robust-Applications-EU-2018-415/m-p/51456#U51456" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;by&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/78"&gt;@joseph_morgan&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;You will see, actually it's quite similar to your approach:&lt;BR /&gt;store some conditions as JSL "symbols" condition 1, condition 2 ... then use them to construct your final expression and evaluate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With some code fixes and &lt;FONT face="courier new,courier"&gt;Expr()&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;Name Expr()&lt;/FONT&gt;&amp;nbsp;here and there (to prevent Jmp from evaluating the conditions before they can be plugged into the final line of code) the code should look like this:&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" );

condition 1 = Expr(Is Missing( :age ));
condition 2 = Expr(:age &amp;gt; 16 );

combined condition=Expr(or());
Insert into(combined condition, Name Expr(condition1));
Insert into(combined condition, Name Expr(condition2));

Eval(Substitute(dt &amp;lt;&amp;lt; Select where( _cond_ ) &amp;lt;&amp;lt; Data View),
 Expr(_cond_),Name Expr(combined condition)));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 23 Mar 2024 21:36:06 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2024-03-23T21:36:06Z</dc:date>
    <item>
      <title>JSL script to filter out entire rows where a particular column contain missing values</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-to-filter-out-entire-rows-where-a-particular-column/m-p/738265#M91960</link>
      <description>&lt;P&gt;Dear Community,&lt;/P&gt;
&lt;P&gt;i am a beginner user and would like to request your kind help with my following code. The argument of the "is missing" function seems incorrect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I d like the script to show a table where rows that contains values in certain ranges are displayed. Also, the rows with empty cells in the two columns used for the filtering are to be excluded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here goes the code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table(); // Assumes you have a data table already opened

// Convert Column1 to numeric data type
dt &amp;lt;&amp;lt; As Numeric("Temperatur");

// Convert Column2 to numeric data type
dt &amp;lt;&amp;lt; As Numeric("Menge");

// Create the conditions to filter the rows
condition1 = Column(dt, "Temperatur") &amp;lt;&amp;lt; Get Values() &amp;gt; 25;
condition2 = Column(dt, "Menge") &amp;lt;&amp;lt; Get Values() &amp;gt; 0;

// Create a condition to remove empty cells
condition3 = Any(Is Missing(dt &amp;lt;&amp;lt; Get Values("Temperatur"))) == 0 | Any(Is Missing(dt &amp;lt;&amp;lt; Get Values("Menge"))) == 0;


// Apply all three conditions to filter the data table
filtered_dt = dt &amp;lt;&amp;lt; Select Where(condition1 &amp;amp; condition2 &amp;amp; condition3);

// Show the filtered data table
filtered_dt &amp;lt;&amp;lt; Show();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you very much upfront for any navigation. I m using JMP version 17&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Michal&lt;/P&gt;</description>
      <pubDate>Sun, 24 Mar 2024 06:37:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-to-filter-out-entire-rows-where-a-particular-column/m-p/738265#M91960</guid>
      <dc:creator>Michal</dc:creator>
      <dc:date>2024-03-24T06:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to filter out entire rows where a particular column contain missing values</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-to-filter-out-entire-rows-where-a-particular-column/m-p/738280#M91962</link>
      <description>&lt;P&gt;Hi Michal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The cool thing in JMP: jou don't have to know any scripting, you can just use the GUI and your mouse.&lt;/P&gt;&lt;P&gt;Then after executing the steps, you can go to the advanced log and check the code ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Rows/ Row Selection/ Select Where (Ctrl + W)&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1711227829155.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62562iA74866BDE580AFB1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1711227829155.png" alt="hogi_0-1711227829155.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;open data view for selected rows:&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1711227878188.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62563i1F55DCB8D620107E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1711227878188.png" alt="hogi_1-1711227878188.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;-&amp;nbsp; check the log:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_2-1711227951991.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62564i4B969896812FBD55/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_2-1711227951991.png" alt="hogi_2-1711227951991.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jmp understands what you want - and even combines the two steps to a single line of code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_3-1711229543223.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62565i8739E012798309CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_3-1711229543223.png" alt="hogi_3-1711229543223.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to construct the command on your own, you can define some strings, concatenate them and then parse and evaluate the final code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cond1 = "Is Missing( :age )";
cond2 = ":age &amp;gt; 16";

Eval(Parse("dt &amp;lt;&amp;lt; Select where( "|| cond1 || " | " || cond2 || " ) &amp;lt;&amp;lt; Data View;"))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My suggestion: invest some time to learn and understand&amp;nbsp;&lt;STRONG&gt;Expression Handling&lt;BR /&gt;A great tutorial:&amp;nbsp;&lt;LI-MESSAGE title="Using JSL to Develop Efficient, Robust Applications (EU 2018 415)" uid="51456" url="https://community.jmp.com/t5/Discovery-Summit-Europe-2018/Using-JSL-to-Develop-Efficient-Robust-Applications-EU-2018-415/m-p/51456#U51456" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;by&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/78"&gt;@joseph_morgan&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;You will see, actually it's quite similar to your approach:&lt;BR /&gt;store some conditions as JSL "symbols" condition 1, condition 2 ... then use them to construct your final expression and evaluate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With some code fixes and &lt;FONT face="courier new,courier"&gt;Expr()&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;Name Expr()&lt;/FONT&gt;&amp;nbsp;here and there (to prevent Jmp from evaluating the conditions before they can be plugged into the final line of code) the code should look like this:&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" );

condition 1 = Expr(Is Missing( :age ));
condition 2 = Expr(:age &amp;gt; 16 );

combined condition=Expr(or());
Insert into(combined condition, Name Expr(condition1));
Insert into(combined condition, Name Expr(condition2));

Eval(Substitute(dt &amp;lt;&amp;lt; Select where( _cond_ ) &amp;lt;&amp;lt; Data View),
 Expr(_cond_),Name Expr(combined condition)));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2024 21:36:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-to-filter-out-entire-rows-where-a-particular-column/m-p/738280#M91962</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-03-23T21:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to filter out entire rows where a particular column contain missing values</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-to-filter-out-entire-rows-where-a-particular-column/m-p/738364#M91971</link>
      <description>&lt;P&gt;You are mixing matrix comparison and selection from data table, in this case you most likely want to just use either &amp;lt;&amp;lt; Select Where or &amp;lt;&amp;lt; Get Rows Where and not &amp;lt;&amp;lt; Get Values (you might want to use &lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/data-table-messages.shtml?os=win&amp;amp;source=application#ww1901136" target="_self"&gt;&amp;lt;&amp;lt; Get Rows Where&lt;/A&gt; instead of &lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/select-rows.shtml?os=win&amp;amp;source=application#ww782678" target="_blank" rel="noopener"&gt;&amp;lt;&amp;lt; Select Where&lt;/A&gt; but this depends what you wish to do).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can combine the conditions directly into a single Select Where statement (if you want to separate them, I would do it with comments unless you wish to reuse exactly the same statements)&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");
dt[[1 2 3 20 30], "height"] = .;
dt[[10 15 16 30], "weight"] = .;


// Comparison
dt &amp;lt;&amp;lt; Select Where((:height &amp;gt; 60) &amp;amp; (:weight &amp;gt; 90));
selrows = dt &amp;lt;&amp;lt; get selected rows; // to get a matrix of selected row numbers

r = dt &amp;lt;&amp;lt; Get Rows Where((:height &amp;gt; 60) &amp;amp; (:weight &amp;gt; 90));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and checking for those missing values is unnecessary in this case&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");
dt[[1 2 3 20 30], "height"] = .;
dt[[10 15 16 30], "weight"] = .;

// Comparison
r1 = dt &amp;lt;&amp;lt; Get Rows Where((:height &amp;gt; 60) &amp;amp; (:weight &amp;gt; 90) &amp;amp; (!IsMissing(:height) | !Is Missing(:weight)));
r2 = dt &amp;lt;&amp;lt; Get Rows Where((:height &amp;gt; 60) &amp;amp; (:weight &amp;gt; 90));
r1 == r2;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 Mar 2024 06:51:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-to-filter-out-entire-rows-where-a-particular-column/m-p/738364#M91971</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-03-24T06:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to filter out entire rows where a particular column contain missing values</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-to-filter-out-entire-rows-where-a-particular-column/m-p/738444#M91983</link>
      <description>&lt;P&gt;Thank you very much, Hogi, with your help, i made it running!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Mar 2024 13:35:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-to-filter-out-entire-rows-where-a-particular-column/m-p/738444#M91983</guid>
      <dc:creator>Michal</dc:creator>
      <dc:date>2024-03-24T13:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to filter out entire rows where a particular column contain missing values</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-to-filter-out-entire-rows-where-a-particular-column/m-p/738445#M91984</link>
      <description>&lt;P&gt;Thank you very much, Jthi, with your help, i made it running!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Mar 2024 13:36:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-to-filter-out-entire-rows-where-a-particular-column/m-p/738445#M91984</guid>
      <dc:creator>Michal</dc:creator>
      <dc:date>2024-03-24T13:36:05Z</dc:date>
    </item>
  </channel>
</rss>

