<?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 do I compare a variables values to a table column value in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-compare-a-variables-values-to-a-table-column-value/m-p/353395#M60284</link>
    <description>&lt;P&gt;This worked really well. Thank you!&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jan 2021 19:33:03 GMT</pubDate>
    <dc:creator>JensRiege</dc:creator>
    <dc:date>2021-01-27T19:33:03Z</dc:date>
    <item>
      <title>How do I compare a variables values to a table column value</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-compare-a-variables-values-to-a-table-column-value/m-p/353102#M60246</link>
      <description>&lt;P&gt;I have what should be a simple problem, but I don't know the right way to phrase it.&lt;/P&gt;
&lt;P&gt;I have a few variables;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; A1 = "44";&lt;/P&gt;
&lt;P&gt;&amp;nbsp; A2 = "47";&lt;/P&gt;
&lt;P&gt;&amp;nbsp; A3 = "50";&lt;/P&gt;
&lt;P&gt;//numbers are in string format intentionally&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And a data table, dt,&amp;nbsp; where these variables are included among many others in one column, column "LOT".&amp;nbsp;If I create a for loop, to find these variables in the table, and mark the rows when they are found, I am not able to find them..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= 3, i++,
    foundlot = "A" || Char( i );
    Show( foundlot );
    dt &amp;lt;&amp;lt; Select Where( :LOT = foundlot ) &amp;lt;&amp;lt; Colors = (5);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I realize the problem is that foundlot is a string "A1", "A2", "A3", ... and does not substitute the value of A1, A2 and A3 to allow a comparison of the value of A1 to the column value in the table.&lt;/P&gt;
&lt;P&gt;What would I need to do to have it substitute the value, rather than compare the column value to the string "A1" which always is not a match?&lt;/P&gt;
&lt;P&gt;Thank you for your help!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:25:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-compare-a-variables-values-to-a-table-column-value/m-p/353102#M60246</guid>
      <dc:creator>JensRiege</dc:creator>
      <dc:date>2023-06-10T23:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare a variables values to a table column value</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-compare-a-variables-values-to-a-table-column-value/m-p/353121#M60247</link>
      <description>&lt;P&gt;I believe these two simple scripts below will handle what you want.&amp;nbsp; The issue you are having, is having the need to indicate that A1, A2 and A3 are not variable values, but are the names of variables.&amp;nbsp; Script 1 will do that for you.&amp;nbsp; The second script is probably a better way to think of your issue.&amp;nbsp; By using a JMP list, you can reference the variables value by using subscripts&lt;SPAN style="background-color: #f5f5f5; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 13px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=current data table();
A1 = "44";
A2 = "47";
A3 = "50";

For( i=1, i&amp;lt;=3, i++,
	foundlot = "A" || char(i);  Show (foundlot);
	Eval(Parse(EvalInsert("\[dt &amp;lt;&amp;lt; Select Where(:LOT == ^foundlot^, current selection("extend") ) ;]\")));
);
dt &amp;lt;&amp;lt; colors( "red");
// or

names default to here(1);
dt=current data table();
aList = {"44", "47", "50" };
For( i=1, i&amp;lt;=3, i++,
	dt &amp;lt;&amp;lt; Select Where( :Lot == aList[i], current selection("extend"));
);
dt &amp;lt;&amp;lt; colors( "red");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="background-color: #f5f5f5; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 13px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 02:30:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-compare-a-variables-values-to-a-table-column-value/m-p/353121#M60247</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-27T02:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare a variables values to a table column value</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-compare-a-variables-values-to-a-table-column-value/m-p/353329#M60280</link>
      <description>Thank you! I will give this a try!</description>
      <pubDate>Wed, 27 Jan 2021 16:44:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-compare-a-variables-values-to-a-table-column-value/m-p/353329#M60280</guid>
      <dc:creator>JensRiege</dc:creator>
      <dc:date>2021-01-27T16:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare a variables values to a table column value</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-compare-a-variables-values-to-a-table-column-value/m-p/353395#M60284</link>
      <description>&lt;P&gt;This worked really well. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 19:33:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-compare-a-variables-values-to-a-table-column-value/m-p/353395#M60284</guid>
      <dc:creator>JensRiege</dc:creator>
      <dc:date>2021-01-27T19:33:03Z</dc:date>
    </item>
  </channel>
</rss>

