<?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: JSL script to check if a single cell value is in a list in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/81762#M36997</link>
    <description>&lt;P&gt;This might be helpful:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "test", Add Rows( 5 ),
	New Column( "CAT", Character, "Nominal",
		Set Values( {"A", "B", "C", "D", "E"} ) ),
	New Column( "time", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [1, 2, 3, 4, 5] ) )
);
look_for_list = {"B", "D"};
found_rows = dt &amp;lt;&amp;lt; get rows where(contains(look_for_list, as column(dt, "CAT")));
print(found_rows);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;[2, 4]&lt;/PRE&gt;</description>
    <pubDate>Mon, 29 Oct 2018 15:29:10 GMT</pubDate>
    <dc:creator>pmroz</dc:creator>
    <dc:date>2018-10-29T15:29:10Z</dc:date>
    <item>
      <title>JSL script to check if a single cell value is in a list</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/81685#M36974</link>
      <description>&lt;P&gt;Given a data table with a column of limited values (se examples below), I would like to write a script that looks at the first cell and checks if it is in a list of values. The purpose would be to use whatever that first value as the conditoin for an IF statement that would then point to a certain set of tasks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone have an idea how to do this?&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CAT&lt;/TD&gt;&lt;TD&gt;time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;or&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CAT&lt;/TD&gt;&lt;TD&gt;time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;V&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;W&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;X&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Y&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Z&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 26 Oct 2018 23:16:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/81685#M36974</guid>
      <dc:creator>mohamed_elhassa</dc:creator>
      <dc:date>2018-10-26T23:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to check if a single cell value is in a list</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/81702#M36975</link>
      <description>&lt;P&gt;I am not sure exactly what you are asking for, however, below is a script that might point you in the right direction&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

theList = {59, 66};

For( i = 1, i &amp;lt;= N Rows( dt ), i++,
	If( N Rows( Loc( theList, :height[i] ) ) &amp;gt; 0,
		Show( i )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Oct 2018 03:33:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/81702#M36975</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-10-27T03:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to check if a single cell value is in a list</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/81762#M36997</link>
      <description>&lt;P&gt;This might be helpful:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "test", Add Rows( 5 ),
	New Column( "CAT", Character, "Nominal",
		Set Values( {"A", "B", "C", "D", "E"} ) ),
	New Column( "time", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [1, 2, 3, 4, 5] ) )
);
look_for_list = {"B", "D"};
found_rows = dt &amp;lt;&amp;lt; get rows where(contains(look_for_list, as column(dt, "CAT")));
print(found_rows);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;[2, 4]&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Oct 2018 15:29:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/81762#M36997</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2018-10-29T15:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to check if a single cell value is in a list</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/81899#M37005</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4550"&gt;@pmroz&lt;/a&gt;&amp;nbsp;and &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;for the scripting help. To be more specific, what I am looking for is to use the check of whether or not the value of the first cell is in the list as the conditions for an if statement which will drive some other actions. I think that both of your scripts fill another array but they're not a strict T/F. I will try to use them and let you know what happens.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Oct 2018 23:36:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/81899#M37005</guid>
      <dc:creator>mohamed_elhassa</dc:creator>
      <dc:date>2018-10-29T23:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to check if a single cell value is in a list</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/877977#M104082</link>
      <description>&lt;P&gt;Came across this thread looking for something similar for closing lingering open data tables while testing code. Used your simple code above. Thought I'd post in case it's useful for anyone coming across this thread:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// list of table names that I want to make sure are closed before running the script
tname = { "TABLE1", "TABLE2", "TABLE3", "TABLE4" };

// loop to see if open tables match the name in the list above, then close them
// need to restart the i counter to i = 0 because it seems closing a table changes the 'i' number associated with the table
For( i = 1, i &amp;lt;= N Table(), i++,

	If( N Rows (Loc( tname, Data Table(i) &amp;lt;&amp;lt; Get Name ) ) &amp;gt; 0, 
		Close(Data Table(i), no save);
		i = 0;
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Jun 2025 17:22:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/877977#M104082</guid>
      <dc:creator>Plotasaurus</dc:creator>
      <dc:date>2025-06-03T17:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: JSL script to check if a single cell value is in a list</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/878146#M104096</link>
      <description>&lt;P&gt;brute force variant:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each ({dt_name, { "TABLE1", "TABLE2", "TABLE3", "TABLE4" },
	Try(Close(Data Table(dt_name), no save) 	)
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jun 2025 12:10:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-script-to-check-if-a-single-cell-value-is-in-a-list/m-p/878146#M104096</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-06-04T12:10:54Z</dc:date>
    </item>
  </channel>
</rss>

