<?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: Select where with hide and exclude does not work in a for loop in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662298#M85108</link>
    <description>&lt;P&gt;Is the "Official" scripting guide, the Scripting Guide available under the Help pull down menu?&lt;/P&gt;
&lt;P&gt;The code for your script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Items( hides ), i++,
	dt &amp;lt;&amp;lt; select where( hides[i] !="");
	dt &amp;lt;&amp;lt; hide and exclude;
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Needs to be changed to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Items( hides ), i++,
	dt &amp;lt;&amp;lt; select where( As Column( dt, hides[i] ) != "" );
	dt &amp;lt;&amp;lt; hide and exclude;
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 25 Jul 2023 21:25:17 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2023-07-25T21:25:17Z</dc:date>
    <item>
      <title>Select where with hide and exclude does not work in a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662149#M85093</link>
      <description>&lt;P&gt;Hello community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to be able to use the for loop to update row exclusions, but when I use it, all the rows get hidden/excluded. Would appreciate any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// This works
dt &amp;lt;&amp;lt; select where( :Flag !="");
dt &amp;lt;&amp;lt; hide and exclude;

// This does not work
For( i = 1, i &amp;lt;= N Items( hides ), i++,
	dt &amp;lt;&amp;lt; select where( hides[i] !="");
	dt &amp;lt;&amp;lt; hide and exclude;
);

// Neither does this
dt &amp;lt;&amp;lt; select where( hides[1] !="");
dt &amp;lt;&amp;lt; hide and exclude;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I know I am asking a lot of questions, since I do not have formal training on jsl, and I am still learning most of the stuff on the fly while completing a project. Would appreciate any good scripting guide manuals. I have the official one, but it still seems incomplete.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 15:11:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662149#M85093</guid>
      <dc:creator>Kenobi</dc:creator>
      <dc:date>2023-07-25T15:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Select where with hide and exclude does not work in a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662212#M85095</link>
      <description>&lt;P&gt;What does hides contain?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 16:24:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662212#M85095</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-07-25T16:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: Select where with hide and exclude does not work in a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662218#M85099</link>
      <description>&lt;P&gt;it contains a list of columns that the user selects in a column dialog, so something like&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;{:Flag, :OZONE}&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jul 2023 16:53:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662218#M85099</guid>
      <dc:creator>Kenobi</dc:creator>
      <dc:date>2023-07-25T16:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: Select where with hide and exclude does not work in a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662227#M85100</link>
      <description>&lt;P&gt;Are you trying to hide and exclude all rows which aren't missing in those columns?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 17:05:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662227#M85100</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-07-25T17:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Select where with hide and exclude does not work in a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662277#M85104</link>
      <description>&lt;P&gt;Yes indeed. When I run the first 2 lines of code, it works fine, but when I am running the same code, using list items, it hides and excludes the entire data table.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 19:23:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662277#M85104</guid>
      <dc:creator>Kenobi</dc:creator>
      <dc:date>2023-07-25T19:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Select where with hide and exclude does not work in a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662283#M85106</link>
      <description>&lt;P&gt;Try adding AsColumn() around your hides[i].&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not directly related to this, but if you have JMP16+ it is usually better to use For Each instead of For&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(4),
	Compress File When Saved(1),
	New Column("Column 1", Character, "Nominal", Set Values({"a", "", "a", ""})),
	New Column("Column 2", Character, "Nominal", Set Values({"", "b", "b", ""}))
);

cols = {:Column 1, :Column 2};

For Each({cur_col}, cols, // if you have JMP16+ usually better to use For Each than for
	dt &amp;lt;&amp;lt; Select Where(cur_col != "") &amp;lt;&amp;lt; Hide and Exclude(1) &amp;lt;&amp;lt; Clear Select
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jul 2023 19:39:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662283#M85106</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-07-25T19:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Select where with hide and exclude does not work in a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662298#M85108</link>
      <description>&lt;P&gt;Is the "Official" scripting guide, the Scripting Guide available under the Help pull down menu?&lt;/P&gt;
&lt;P&gt;The code for your script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Items( hides ), i++,
	dt &amp;lt;&amp;lt; select where( hides[i] !="");
	dt &amp;lt;&amp;lt; hide and exclude;
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Needs to be changed to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Items( hides ), i++,
	dt &amp;lt;&amp;lt; select where( As Column( dt, hides[i] ) != "" );
	dt &amp;lt;&amp;lt; hide and exclude;
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jul 2023 21:25:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-where-with-hide-and-exclude-does-not-work-in-a-for-loop/m-p/662298#M85108</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-07-25T21:25:17Z</dc:date>
    </item>
  </channel>
</rss>

