<?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 rows in one table with values identical in another table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Select-rows-in-one-table-with-values-identical-in-another-table/m-p/535419#M75779</link>
    <description>&lt;P&gt;Here's what I do to a) get all nominal values in a given column of one table and b) use these values to make a selection in a different table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;yourSelection = Associative array( tableB:"col-1" ) &amp;lt;&amp;lt; Get Keys; // gets an array of the values in col-1 in tableB

tableA &amp;lt;&amp;lt; Select Where( Contains( yourSelection, :"col-15" )); // should select all rows with identical values in col-15 in tableA&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 19 Aug 2022 12:41:31 GMT</pubDate>
    <dc:creator>Ressel</dc:creator>
    <dc:date>2022-08-19T12:41:31Z</dc:date>
    <item>
      <title>Select rows in one table with values identical in another table</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-in-one-table-with-values-identical-in-another-table/m-p/535412#M75776</link>
      <description>&lt;P&gt;I have two tables: tableA and tableB.&lt;/P&gt;&lt;P&gt;Rows in one column (say col-1) in tableB has values also occurring in tableA in a column (say col-15). Length or col-15 &amp;gt;&amp;gt; col-1.&lt;/P&gt;&lt;P&gt;Can I interactively select the rows in col-15 (of tableA) with entries also occurring in col-1 (of table-B)?&lt;/P&gt;&lt;P&gt;If interactive selection is not possible, how to script such a selection process?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:53:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-in-one-table-with-values-identical-in-another-table/m-p/535412#M75776</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-06-10T23:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows in one table with values identical in another table</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-in-one-table-with-values-identical-in-another-table/m-p/535418#M75778</link>
      <description>&lt;P&gt;I think you will have to join the tables or use query builder if you want to do this interactively. Scripting will have many different options depending on how rows are selected and what is being selected.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 12:27:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-in-one-table-with-values-identical-in-another-table/m-p/535418#M75778</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-08-19T12:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows in one table with values identical in another table</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-in-one-table-with-values-identical-in-another-table/m-p/535419#M75779</link>
      <description>&lt;P&gt;Here's what I do to a) get all nominal values in a given column of one table and b) use these values to make a selection in a different table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;yourSelection = Associative array( tableB:"col-1" ) &amp;lt;&amp;lt; Get Keys; // gets an array of the values in col-1 in tableB

tableA &amp;lt;&amp;lt; Select Where( Contains( yourSelection, :"col-15" )); // should select all rows with identical values in col-15 in tableA&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Aug 2022 12:41:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-in-one-table-with-values-identical-in-another-table/m-p/535419#M75779</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2022-08-19T12:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows in one table with values identical in another table</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-in-one-table-with-values-identical-in-another-table/m-p/535496#M75784</link>
      <description>&lt;P&gt;If the values are unique, you could try to virtually link tables, but the result is different.&lt;/P&gt;
&lt;P&gt;In general (JSL) I think I would apply a row state handler, see screenshot and example. See also Scripting Index for Examples ...&lt;/P&gt;
&lt;P&gt;You can delete the debugging part "print, show ", its only for better understanding.&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="Georg_0-1660918444000.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44863iCFDAFB38A56156F8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Georg_0-1660918444000.png" alt="Georg_0-1660918444000.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dtA = New Table( "tableA", add rows( 10 ), New Column( "col_15", "Numeric", "Ordinal", set each value( Random Integer( 10 ) ) ) );
dtB = New Table( "tableB", add rows( 10 ), New Column( "col_1", "Numeric", "Ordinal", set each value( Random Integer( 10 ) ) ) );

f = Function( {a}, 
	Show( dtA &amp;lt;&amp;lt; get selected rows );
	val_lst = dtA:col_15[dtA &amp;lt;&amp;lt; get selected rows];
	dtB &amp;lt;&amp;lt; clear select();
	For Each( {value}, val_lst, print(value); dtB &amp;lt;&amp;lt; select where( :col_1 == value, current selection( "extend" ) ) );
);

rs = dtA &amp;lt;&amp;lt; make row state handler( f );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 14:19:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-in-one-table-with-values-identical-in-another-table/m-p/535496#M75784</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2022-08-19T14:19:01Z</dc:date>
    </item>
  </channel>
</rss>

