<?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 to use a list to select rows with an specific value in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-use-a-list-to-select-rows-with-an-specific-value/m-p/357996#M60815</link>
    <description>&lt;P&gt;You were pretty close in getting done what you want.&amp;nbsp; Below is my rework of your code.&amp;nbsp; Please note that your tableList list is redundant with the newdt list that you are referencing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt4 = Current Data Table();
uniqueVals = {"2021_file1_T1", "2021_file1_T2"};

//tableList = {};
newdt = {};

For( i = 1, i &amp;lt;= N Items( uniqueVals ), i++,
	dt4 &amp;lt;&amp;lt; select where( As Column( "Type" ) == uniqueVals[i] );
	dt4 &amp;lt;&amp;lt; Select Columns( all );
	newdt[i] = dt4 &amp;lt;&amp;lt; Subset( Selected columns );
	//Insert Into( tableList, Data Table( newdt[i] ) );
	dt4 &amp;lt;&amp;lt; Clear Column Selection();
	dt4 &amp;lt;&amp;lt; Clear Select();
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 10 Feb 2021 22:11:13 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-02-10T22:11:13Z</dc:date>
    <item>
      <title>How to use a list to select rows with an specific value</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-a-list-to-select-rows-with-an-specific-value/m-p/357983#M60814</link>
      <description>&lt;P&gt;Hi I am trying to use a list of Names that populate a column to select the matching rows of another column (in another Table) in order to subset the table and generate several different subsets.&lt;/P&gt;&lt;P&gt;Getting the Names/Values from the first column is no problem but I cannot find the correct syntax for the loop.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt4 = Current Data Table();
uniqueVals = {"2021_file1_T1", "2021_file1_T2"};

tableList= {};

For(i=1, i&amp;lt; N Items(uniqueVals), i++,
dt4 &amp;lt;&amp;lt; select where( As Column("Type") == [i] ) );
dt4 &amp;lt;&amp;lt; Select Columns (all);
newdt[i] = dt4 &amp;lt;&amp;lt; Subset( Selected columns );
Insert Into(tableList, Data Table(newdt[i]));
dt4 &amp;lt;&amp;lt; Clear Column Selection();
dt4 &amp;lt;&amp;lt; Clear Select();
);// end of For&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I think that my basic logic is OK&amp;nbsp; since this code works very well&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt4 &amp;lt;&amp;lt; select where( As Column("Type") =="2021_file1_T2");
dt4 &amp;lt;&amp;lt; Select Columns(all);
dt4 &amp;lt;&amp;lt; Subset (Selected columns);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But I cannot figure out how to pass [i] to the "Select Where".&amp;nbsp; Attached is a simplified test table.&lt;BR /&gt;I will appreciate any hints/ solution/suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:05:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-a-list-to-select-rows-with-an-specific-value/m-p/357983#M60814</guid>
      <dc:creator>ALopez</dc:creator>
      <dc:date>2023-06-09T22:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a list to select rows with an specific value</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-a-list-to-select-rows-with-an-specific-value/m-p/357996#M60815</link>
      <description>&lt;P&gt;You were pretty close in getting done what you want.&amp;nbsp; Below is my rework of your code.&amp;nbsp; Please note that your tableList list is redundant with the newdt list that you are referencing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt4 = Current Data Table();
uniqueVals = {"2021_file1_T1", "2021_file1_T2"};

//tableList = {};
newdt = {};

For( i = 1, i &amp;lt;= N Items( uniqueVals ), i++,
	dt4 &amp;lt;&amp;lt; select where( As Column( "Type" ) == uniqueVals[i] );
	dt4 &amp;lt;&amp;lt; Select Columns( all );
	newdt[i] = dt4 &amp;lt;&amp;lt; Subset( Selected columns );
	//Insert Into( tableList, Data Table( newdt[i] ) );
	dt4 &amp;lt;&amp;lt; Clear Column Selection();
	dt4 &amp;lt;&amp;lt; Clear Select();
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Feb 2021 22:11:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-a-list-to-select-rows-with-an-specific-value/m-p/357996#M60815</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-02-10T22:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a list to select rows with an specific value</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-a-list-to-select-rows-with-an-specific-value/m-p/358004#M60817</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;, So close yet so far.... Thank you very much for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 22:48:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-a-list-to-select-rows-with-an-specific-value/m-p/358004#M60817</guid>
      <dc:creator>ALopez</dc:creator>
      <dc:date>2021-02-10T22:48:45Z</dc:date>
    </item>
  </channel>
</rss>

