<?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 search a text within another column ? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-search-a-text-within-another-column/m-p/463278#M70798</link>
    <description>&lt;P&gt;Thanks for your quick reply.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Feb 2022 12:02:03 GMT</pubDate>
    <dc:creator>LogitTurtle576</dc:creator>
    <dc:date>2022-02-23T12:02:03Z</dc:date>
    <item>
      <title>How to search a text within another column ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-search-a-text-within-another-column/m-p/463242#M70794</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't find a solution for the following problem.&lt;/P&gt;&lt;P&gt;I have 2 columns, both containing text. I would like to create a new column to tell me if the text in column 2 can be found in column 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do this ? I started in Excel but seems too complex.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example :&lt;/P&gt;&lt;P&gt;Col1 is the whole list&lt;/P&gt;&lt;P&gt;Col2 are the text I want to find in col1.&lt;/P&gt;&lt;P&gt;Col3 will tell me if the text in the col2 on the same row can be found in the list in col1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;col1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;col2&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;col3&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;GCF055.TOP&lt;/TD&gt;&lt;TD&gt;FCN4222&lt;/TD&gt;&lt;TD&gt;not found&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCF015.DOWN&lt;/TD&gt;&lt;TD&gt;FCNV4222&lt;/TD&gt;&lt;TD&gt;found&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCFCNV422.TOP&lt;/TD&gt;&lt;TD&gt;FCNV4222FF&lt;/TD&gt;&lt;TD&gt;not found&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCF866.TOP&lt;/TD&gt;&lt;TD&gt;GCF009&lt;/TD&gt;&lt;TD&gt;found&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCGCF009.DOWN&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCF866.UP&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SCF015.UP&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;Hope being clear enough in my question.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:44:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-search-a-text-within-another-column/m-p/463242#M70794</guid>
      <dc:creator>LogitTurtle576</dc:creator>
      <dc:date>2023-06-10T23:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to search a text within another column ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-search-a-text-within-another-column/m-p/463271#M70795</link>
      <description>&lt;P&gt;Here is one way to approach this, using a column formula.&amp;nbsp; Create a Character column and then paste this into the formula for the column.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1645611920806.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40244i871B2A86C9BDA802/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1645611920806.png" alt="txnelson_0-1645611920806.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x = "not found";
For( i = 1, i &amp;lt;= N Rows( Current Data Table() ), i++,
	If( Contains( :col1[i], :col2[Row()] ),
		x = "found";
		Break();
	)
);
x;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please note, your sample data table's entry for row 2 is incorrect.&amp;nbsp; FCNV4222 is not found in any of the rows for co1.&amp;nbsp; Row 3 value contains FCNV422 but does not contain FCNV4222&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 10:25:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-search-a-text-within-another-column/m-p/463271#M70795</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-02-23T10:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to search a text within another column ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-search-a-text-within-another-column/m-p/463276#M70796</link>
      <description>&lt;P&gt;There are many many ways to do this, solution will differ depending on if high performance is required or not. Below is one example using associative array to get unique values, concat items to make string to compare to and then Contains to look for matches.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(7),
	New Column("col1",
		Character,
		"Nominal",
		Set Values({"GCF055.TOP", "SCF015.DOWN", "SCFCNV422.TOP", "SCF866.TOP", "SCGCF009.DOWN", "SCF866.UP", "SCF015.UP"})
	),
	New Column("col2", Character(16), "Nominal", Set Values({"FCN4222", "FCNV4222", "FCNV4222FF", "GCF009", "", "", ""})),
	New Column("col3", Character(16), "Nominal", Set Values({"not found", "found", "not found", "found", "", "", ""}))
);


dt &amp;lt;&amp;lt; New Column("Found", Character, Nominal, &amp;lt;&amp;lt; Formula(
	If(Row() == 1,
		col_vals = Associative Array(:col1 &amp;lt;&amp;lt; get values) &amp;lt;&amp;lt; get keys; // to eliminate dublicates
		search_str = Concat Items(col_vals, " "); // should use some character not found as separator
	);
	If(!IsMissing(:col2),
		If(Contains(search_str, :col2),
			"found",
			"not found"
		);
	,
		""
	);
));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Feb 2022 11:02:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-search-a-text-within-another-column/m-p/463276#M70796</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-02-23T11:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to search a text within another column ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-search-a-text-within-another-column/m-p/463277#M70797</link>
      <description>&lt;P&gt;Many thanks for your quick reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note : you are right. My example was not completely correct.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 12:01:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-search-a-text-within-another-column/m-p/463277#M70797</guid>
      <dc:creator>LogitTurtle576</dc:creator>
      <dc:date>2022-02-23T12:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to search a text within another column ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-search-a-text-within-another-column/m-p/463278#M70798</link>
      <description>&lt;P&gt;Thanks for your quick reply.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 12:02:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-search-a-text-within-another-column/m-p/463278#M70798</guid>
      <dc:creator>LogitTurtle576</dc:creator>
      <dc:date>2022-02-23T12:02:03Z</dc:date>
    </item>
  </channel>
</rss>

