<?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: Check if wafer from an input string is contained within a data table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395525#M64622</link>
    <description>&lt;P&gt;Also used this discussion post to aid in writing the code above&lt;LI-MESSAGE title="Re: Quick way to compare two lists (uncommon elements)?" uid="34321" url="https://community.jmp.com/t5/Discussions/Quick-way-to-compare-two-lists-and-identify-the-uncommon/m-p/34321#U34321" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Jun 2021 19:59:14 GMT</pubDate>
    <dc:creator>saneal</dc:creator>
    <dc:date>2021-06-28T19:59:14Z</dc:date>
    <item>
      <title>Check if wafer from an input string is contained within a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395052#M64563</link>
      <description>&lt;P&gt;I have an input string from below:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Rows( dtWaferIDList ), i++,
	tempi = Column( dtWaferIDList, 1 )[i];
	InputString = If( i == 1, "'", "" ) || InputString || tempi || If( i &amp;lt; N Rows( dtWaferIDList ), "','", "'" );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And a table1 that I pull from a database. I would like to check to see if (in the Wafer column of table 1) all the wafers from the input string are contained in that column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;- if all wafers have data: display message = "data for all wafers available".&lt;/P&gt;&lt;P&gt;- if not: display message = "no data available".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:32:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395052#M64563</guid>
      <dc:creator>saneal</dc:creator>
      <dc:date>2023-06-10T23:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Check if wafer from an input string is contained within a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395065#M64564</link>
      <description>&lt;P&gt;You could most likely use Associative Array for this comparison&amp;nbsp;&lt;A href="https://www.jmp.com/support/help/en/16.0/index.shtml#page/jmp/applications-for-associative-arrays.shtml" target="_blank" rel="noopener"&gt;Applications for Associative Arrays&lt;/A&gt;&amp;nbsp;. Check out the part&amp;nbsp; &lt;EM&gt;Compare Columns in Two Different Data Tables&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 15:24:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395065#M64564</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-06-22T15:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Check if wafer from an input string is contained within a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395168#M64578</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;has pointed you in the right direction.&amp;nbsp; Your proposed approach is using a very long literal string.&amp;nbsp; I suggest that you either use associative arrays, or a JMP list.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is a simple script that opens a data table that contains wafers.&amp;nbsp; It then creates a data table that has a random set of wafers.&amp;nbsp; Finally it checks to see if the random set contains all wafers from the first data table.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

unique wafers = associative array(dt:Wafer);

// Create a random wafer table and see if it contains all wafers
dtRand = new table("Random",
	add rows(60),
	new column("Rand Wafer", set each value(random integer(1,24)));
);

random wafers = associative array(dtRand:Rand wafer);
Random wafers &amp;lt;&amp;lt; Intersect( unique wafers );

if(n items(Random wafers) == n items( unique wafers),
   msg = "data for all wafers available",
   msg = "no data available"
 );

new window("Message", &amp;lt;&amp;lt;modal,
	text box(msg)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Jun 2021 17:29:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395168#M64578</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-06-22T17:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Check if wafer from an input string is contained within a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395521#M64621</link>
      <description>&lt;P&gt;Hello Nelson,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate the help! I am a bit new to JMP still and haven't used Associative Arrays at all yet. I have read up on it on the scripting guide and index; but am still having some confusion. Here is where I am at in my code: (directly after opening the table WaferRgDt from a database)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;unique wafers = Associative Array( WaferRgDt:Wafer );
given wafers = Associative Array( dtWaferIDList:WaferList );
intersection = unique wafers; intersection &amp;lt;&amp;lt; Intersect( given wafers); //intersection between arrays

//uncommmon2 represents wafers that have no data associated with it.
uncommon2 = given wafers; uncommon2 &amp;lt;&amp;lt;remove(intersection); show(uncommon2 &amp;lt;&amp;lt; Get Keys);

if(n items( given wafers ) == n items( unique wafers ),
   msg = "Data for all wafers is available.",
   //else
   msg = Write("\!N#Data is unavailable for the following wafers:", uncommon2 &amp;lt;&amp;lt; Get Keys)
 );

new window("Message", &amp;lt;&amp;lt;modal,
	text box(msg)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When I run this I get an empty messagebox with a period... so something seems wrong still. Wondering if its a logic issue or syntax. I have had some trouble finding how to write keys in a messagebox if its even possible to do. Hope that was clear enough. Thanks again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 14:53:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395521#M64621</guid>
      <dc:creator>saneal</dc:creator>
      <dc:date>2021-06-23T14:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Check if wafer from an input string is contained within a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395525#M64622</link>
      <description>&lt;P&gt;Also used this discussion post to aid in writing the code above&lt;LI-MESSAGE title="Re: Quick way to compare two lists (uncommon elements)?" uid="34321" url="https://community.jmp.com/t5/Discussions/Quick-way-to-compare-two-lists-and-identify-the-uncommon/m-p/34321#U34321" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jun 2021 19:59:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395525#M64622</guid>
      <dc:creator>saneal</dc:creator>
      <dc:date>2021-06-28T19:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Check if wafer from an input string is contained within a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395551#M64624</link>
      <description>&lt;P&gt;To convert a list of strings into a string you can use Concat Items()&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
aa = Associative Array({"bun",
	"shoe",
	"tree",
	"door"}
);

uniqKeys = aa &amp;lt;&amp;lt; get keys;
Show(uniqKeys);
Show(Concat Items(uniqKeys, ", "));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 15:18:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395551#M64624</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-06-23T15:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Check if wafer from an input string is contained within a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395555#M64625</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't see how that solves my particular issue. When I run your script, nothing happens. I need the keys from the associative array to be visible to the user and displayed in a msg box.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;unique wafers = Associative Array( WaferRgDt:Wafer );
given wafers = Associative Array( dtWaferIDList:WaferList );
intersection = unique wafers; intersection &amp;lt;&amp;lt; Intersect( given wafers); //intersection between arrays

//uncommon represents wafers that have no data associated with it.
uncommon = given wafers; uncommon2 &amp;lt;&amp;lt;remove(intersection); show(uncommon &amp;lt;&amp;lt; Get Keys);

if(n items( given wafers ) == n items( unique wafers ),
   msg = "Data for all wafers is available.",
   //else
   msg = Show(Concat Items("\!N#Data is unavailable for the following wafers:", uncommon &amp;lt;&amp;lt; Get Keys))
 );

new window("Message", &amp;lt;&amp;lt;modal,
	text box(msg)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Jun 2021 15:31:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395555#M64625</guid>
      <dc:creator>saneal</dc:creator>
      <dc:date>2021-06-23T15:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Check if wafer from an input string is contained within a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395556#M64626</link>
      <description>&lt;P&gt;Use debug Show()s and small data set to test where you go wrong (open log window from View / Log).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this will help you forward:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt1 = Open("$SAMPLE_DATA/Big Class.jmp");
dt1 &amp;lt;&amp;lt; Select Rows([1,2,3]);
dt2 = dt1 &amp;lt;&amp;lt; Subset(selected rows);
dt1 &amp;lt;&amp;lt; clear select;

dt1_uniq = Associative Array(dt1:name);
dt2_uniq = Associative Array(dt2:name);
dt1_copy = dt1_uniq;
dt2_copy = dt2_uniq;
dt1_copy &amp;lt;&amp;lt; Remove(dt2_copy);

Show(concat items(dt1_uniq &amp;lt;&amp;lt; get keys, ", "));
Show(concat items(dt2_uniq &amp;lt;&amp;lt; get keys, ", "));
Show(concat items(dt1_copy &amp;lt;&amp;lt; get keys, ", "));
Show(N Items(dt1_uniq), N Items(dt2_uniq), N Items(dt1_copy));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Jun 2021 15:33:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395556#M64626</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-06-23T15:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Check if wafer from an input string is contained within a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395559#M64627</link>
      <description>&lt;P&gt;Your msg value is being specified incorrectly.&amp;nbsp; The below will work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;msg = "\!N#Data is unavailable for the following wafers:" || Char( uncommon2 &amp;lt;&amp;lt; Get Keys );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Jun 2021 15:37:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395559#M64627</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-06-23T15:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Check if wafer from an input string is contained within a data table</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395577#M64630</link>
      <description>&lt;P&gt;Thank you both! Looks to be working now. I appreciate it!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 16:48:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-wafer-from-an-input-string-is-contained-within-a-data/m-p/395577#M64630</guid>
      <dc:creator>saneal</dc:creator>
      <dc:date>2021-06-23T16:48:50Z</dc:date>
    </item>
  </channel>
</rss>

