<?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 check if list of columns exist and report those that are missing using a pop-up window? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515303#M74195</link>
    <description>&lt;P&gt;&amp;nbsp;Hi Rob!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the suggestion! I would like to conduct this task using JSL because I am planning to incorporate it in some of my scripts, but would also like to have a user friendly GUI message for the users in case columns are missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks though!&lt;/P&gt;&lt;P&gt;Adi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jun 2022 23:14:25 GMT</pubDate>
    <dc:creator>Lavik17</dc:creator>
    <dc:date>2022-06-28T23:14:25Z</dc:date>
    <item>
      <title>How to check if list of columns exist and report those that are missing using a pop-up window?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515287#M74193</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;I would like to test if a list of 5 column names exist in a data table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If one or more are missing, I would like to have a window pop up telling the user which columns are missing. If all columns are present the script should continue its run.&lt;/P&gt;&lt;P&gt;Could you please point me in the right direction on how to write it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:02:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515287#M74193</guid>
      <dc:creator>Lavik17</dc:creator>
      <dc:date>2023-06-09T17:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if list of columns exist and report those that are missing using a pop-up window?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515294#M74194</link>
      <description>&lt;P&gt;Hi Lavik17,&lt;/P&gt;&lt;P&gt;Have you tried using the&amp;nbsp;Columns View Selector in the column drop-down menu? Then, using the summary statistics function, you can effortlessly search your five-column names and determine if they are missing data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 23:04:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515294#M74194</guid>
      <dc:creator>DirtyDataCoLLC</dc:creator>
      <dc:date>2022-06-28T23:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if list of columns exist and report those that are missing using a pop-up window?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515303#M74195</link>
      <description>&lt;P&gt;&amp;nbsp;Hi Rob!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the suggestion! I would like to conduct this task using JSL because I am planning to incorporate it in some of my scripts, but would also like to have a user friendly GUI message for the users in case columns are missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks though!&lt;/P&gt;&lt;P&gt;Adi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 23:14:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515303#M74195</guid>
      <dc:creator>Lavik17</dc:creator>
      <dc:date>2022-06-28T23:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if list of columns exist and report those that are missing using a pop-up window?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515323#M74199</link>
      <description>&lt;P&gt;Here is a simple example of one way to do this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );

colList = dt &amp;lt;&amp;lt; get column names( string );

requiredList = {"name", "sex", "shoe size"};

For( i = N Items( requiredList ), i &amp;gt;= 1, i--,
	If( Contains( colList, requiredList[i] ),
		Remove From( requiredList, i, 1 )
	)
);

stop = "NO";
If( N Items( requiredList ) &amp;gt; 0,
	stop = "YES";
	New Window( "Error",
		Modal,
		V List Box(
			Text Box( "The following column(s) are required" ),
			Text Box( "but were not found in the data table." ),
			Spacer Box( size( 1, 10 ) ),
			List Box( requiredList )
		)
	);
);
If( stop == "YES", Throw() );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jun 2022 01:04:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515323#M74199</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-06-29T01:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if list of columns exist and report those that are missing using a pop-up window?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515326#M74200</link>
      <description>&lt;P&gt;You can use the &lt;CODE class=" language-jsl"&gt;Remove()&lt;/CODE&gt; method of Associative Arrays to do this without any JSL loops:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

reference table = New Table( "TEST",
	&amp;lt;&amp;lt;New Column( "A" ),
	&amp;lt;&amp;lt;New Column( "B" ),
//	&amp;lt;&amp;lt;New Column( "C" ),
	&amp;lt;&amp;lt;New Column( "D" ),
//	&amp;lt;&amp;lt;New Column( "E" ),
	&amp;lt;&amp;lt;New Column( "F" ),
//	&amp;lt;&amp;lt;New Column( "G" ),
	&amp;lt;&amp;lt;New Column( "H" ),
	&amp;lt;&amp;lt;New Column( "I" ),
	&amp;lt;&amp;lt;New Column( "J" ),
	&amp;lt;&amp;lt;New Column( "K" ),
	&amp;lt;&amp;lt;New Column( "L" ),
	&amp;lt;&amp;lt;New Column( "M" ),
	&amp;lt;&amp;lt;New Column( "N" ),
	&amp;lt;&amp;lt;New Column( "O" )
);

cols of interest = {"B","C","D","E","F"};

table cols = reference table &amp;lt;&amp;lt; Get Column Names( "String" );

table cols aa = Associative Array( table cols );
cols of interest aa = Associative Array( cols of interest );

cols of interest aa &amp;lt;&amp;lt; Remove( table cols aa );

cols missing = cols of interest aa &amp;lt;&amp;lt; Get Keys;

If( N Items( cols missing ),
	New Window( "Error",
		&amp;lt;&amp;lt;Modal,
		Text Box( "Some columns are missing!" ),
		Text Box( Concat Items( cols missing, ", " ) )
	);
	Throw()
);

Print( "rest of script..." )&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jun 2022 02:16:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515326#M74200</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2022-06-29T02:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if list of columns exist and report those that are missing using a pop-up window?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515833#M74258</link>
      <description>&lt;P&gt;Thank you! This is exactly what I was looking for!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 20:48:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515833#M74258</guid>
      <dc:creator>Lavik17</dc:creator>
      <dc:date>2022-06-29T20:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if list of columns exist and report those that are missing using a pop-up window?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515834#M74259</link>
      <description>&lt;P&gt;Thank you! This is an interesting solution! I really should learn to work with&amp;nbsp;&lt;SPAN&gt;Associative Arrays...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 20:49:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/515834#M74259</guid>
      <dc:creator>Lavik17</dc:creator>
      <dc:date>2022-06-29T20:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if list of columns exist and report those that are missing using a pop-up window?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/595242#M79894</link>
      <description>&lt;P&gt;The approach with the associative array is great!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;But please note that the comparisons described here just find &lt;EM&gt;&lt;STRONG&gt;exact&lt;/STRONG&gt; &lt;/EM&gt;matches.&lt;/P&gt;&lt;P&gt;In general for Jmp it doesn't matter if there are capital letters in the column name - or spaces.&lt;/P&gt;&lt;P&gt;So, depending on your application case, maybe the&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;check if list of columns exist&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;shouldn't care either.&lt;/P&gt;&lt;P&gt;Very robust is&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;'s approach :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;r=try(column(dt,tn)&amp;lt;&amp;lt;get name,"");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;LI-MESSAGE title="check if column exists?" uid="572468" url="https://community.jmp.com/t5/Discussions/check-if-column-exists/m-p/572468#U572468" 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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With all the pitfalls of column existence checks - in my opinion Jmp should provide a robust way to ask a data table if a column exists.&lt;BR /&gt;Here is the post in the wish list:&lt;BR /&gt;&lt;LI-MESSAGE title="data table : message column exists(colname)?" uid="573018" url="https://community.jmp.com/t5/JMP-Wish-List/data-table-message-column-exists-colname/m-p/573018#U573018" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 19:52:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-check-if-list-of-columns-exist-and-report-those-that-are/m-p/595242#M79894</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-06-27T19:52:36Z</dc:date>
    </item>
  </channel>
</rss>

