<?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: Search and select word on string in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Search-and-select-word-on-string/m-p/729894#M91259</link>
    <description>&lt;P&gt;Just a follow up question, can I use this selected rows in matching to other tables? Like in Update?&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2024 06:43:15 GMT</pubDate>
    <dc:creator>UserID16644</dc:creator>
    <dc:date>2024-03-05T06:43:15Z</dc:date>
    <item>
      <title>Search and select word on string</title>
      <link>https://community.jmp.com/t5/Discussions/Search-and-select-word-on-string/m-p/729833#M91251</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two different data tables, and I need to find and select if the word exist on the other table.&lt;/P&gt;&lt;P&gt;I tried using Contains() but is not working. Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example:&lt;/P&gt;&lt;P&gt;dt1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;dog&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;cat&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;fish&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;bird&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;cow&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dt2&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;dog&amp;amp;gorilla&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;mouse, giraffe&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;shark, whale, penguin&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ostrich&amp;amp;bird&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;lion&amp;amp;tiger,cow&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result (text in bold characters are selected):&amp;nbsp;&lt;/P&gt;&lt;P&gt;dt2&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;dog&amp;amp;gorilla&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;mouse, giraffe&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;shark, whale, penguin&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;ostrich&amp;amp;bird&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;lion&amp;amp;tiger,cow&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 05 Mar 2024 03:17:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Search-and-select-word-on-string/m-p/729833#M91251</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2024-03-05T03:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Search and select word on string</title>
      <link>https://community.jmp.com/t5/Discussions/Search-and-select-word-on-string/m-p/729854#M91253</link>
      <description>&lt;P&gt;Here is one way to do what you are looking for.&amp;nbsp; Please note, I believe your table that shows the results has row 3 incorrectly selected.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Create the tables
dt1 = New Table( "Lookup", Add Rows( 5 ), New Column( "key", Character, Set Values( {"dog", "cat", "fish", "bird", "cow"} ) ) );
dt2 = New Table( "Base",
	Add Rows( 5 ),
	New Column( "Target", Character, Set Values( {"dog&amp;amp;gorilla", "mouse, giraffe", "shark, whale, penguin", "ostrich&amp;amp;bird", "lion&amp;amp;tiger,cow"} ) )
);

// Place all key values into a list
KeyList = dt1:key &amp;lt;&amp;lt; get values;

// Loop across the keys and search each row of Target for the 
// match
For Each( {val}, keyList,
	For Each Row(
		If( Contains( :Target, val ),
			Row State( Row() ) = Selected State( 1 )
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1709611455018.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/61805i407DF9EA85849022/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1709611455018.png" alt="txnelson_0-1709611455018.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 04:04:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Search-and-select-word-on-string/m-p/729854#M91253</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-03-05T04:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Search and select word on string</title>
      <link>https://community.jmp.com/t5/Discussions/Search-and-select-word-on-string/m-p/729894#M91259</link>
      <description>&lt;P&gt;Just a follow up question, can I use this selected rows in matching to other tables? Like in Update?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 06:43:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Search-and-select-word-on-string/m-p/729894#M91259</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2024-03-05T06:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Search and select word on string</title>
      <link>https://community.jmp.com/t5/Discussions/Search-and-select-word-on-string/m-p/729938#M91265</link>
      <description>&lt;P&gt;I am not understand your question.&amp;nbsp; However, you can easily create a subset of the base table that contains just the selected rows, and then you can update another table from that table.&amp;nbsp; Here is the JSL to do the subsetting&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt3 = dt2 &amp;lt;&amp;lt; Subset( selected columns( 0 ), selected rows( 1 ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Mar 2024 10:03:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Search-and-select-word-on-string/m-p/729938#M91265</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-03-05T10:03:30Z</dc:date>
    </item>
  </channel>
</rss>

