<?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 Check column name if existing in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/311971#M56500</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a list of column names that I need to check from my table if it exist.&lt;/P&gt;&lt;P&gt;How will I check every columns of the table and prompt an error and stop the program from running if it is not existing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;col_list = {"Col1", "Col2", "Col3", "Col4", "Col5" };
//checks column if exist&lt;BR /&gt;&lt;BR /&gt;     //..code continue running&lt;BR /&gt;
//if column doesn't exist&lt;BR /&gt;
    //..code will stop script &amp;amp; error prompt&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:19:28 GMT</pubDate>
    <dc:creator>UserID16644</dc:creator>
    <dc:date>2023-06-10T23:19:28Z</dc:date>
    <item>
      <title>Check column name if existing</title>
      <link>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/311971#M56500</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a list of column names that I need to check from my table if it exist.&lt;/P&gt;&lt;P&gt;How will I check every columns of the table and prompt an error and stop the program from running if it is not existing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;col_list = {"Col1", "Col2", "Col3", "Col4", "Col5" };
//checks column if exist&lt;BR /&gt;&lt;BR /&gt;     //..code continue running&lt;BR /&gt;
//if column doesn't exist&lt;BR /&gt;
    //..code will stop script &amp;amp; error prompt&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:19:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/311971#M56500</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2023-06-10T23:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Check column name if existing</title>
      <link>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/312011#M56504</link>
      <description>&lt;P&gt;The method I use is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;col_list = {"col1", "col2", "col3"};
for(i=1,i&amp;lt;=N Items(col_list),i++,
    if(try(column(col_list[i])&amp;lt;&amp;lt;get name,"") == "", throw());
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Sep 2020 03:11:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/312011#M56504</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-09-24T03:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Check column name if existing</title>
      <link>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/312013#M56506</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;animals = Open( "C:\Animals.jmp" );
dt_animals = Data Table( "Animals" );

col_list = {"species", "subject", "miles", "season", "name"};
For( i = 1, i &amp;lt;= N Items( col_list ), i++,
    If( Try( Column( col_list[i] ) &amp;lt;&amp;lt; get name, "" ) == "",
        Throw()
    )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I'm sure I missed something, it's not working for me&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 11:15:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/312013#M56506</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2020-09-24T11:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Check column name if existing</title>
      <link>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/312014#M56507</link>
      <description>&lt;P&gt;What is it that isn't working?&amp;nbsp; I ran your code, and when it reached the column called "name" the code stopped.&lt;/P&gt;
&lt;P&gt;The value of the variable "i" ended up as 5, since it stopped processing on the 5th loop.&amp;nbsp; If it had completed processing, the variable "i" would have been 6.&lt;/P&gt;
&lt;P&gt;If there was code beyond this piece of code, it would not have been processed.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 04:02:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/312014#M56507</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-09-24T04:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Check column name if existing</title>
      <link>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/312015#M56508</link>
      <description>The prompt where it will tell what column is missing</description>
      <pubDate>Thu, 24 Sep 2020 04:08:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/312015#M56508</guid>
      <dc:creator>UserID16644</dc:creator>
      <dc:date>2020-09-24T04:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: Check column name if existing</title>
      <link>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/312178#M56513</link>
      <description>&lt;P&gt;Here is a modification of the script that I previously posted.&lt;/P&gt;
&lt;P&gt;I strongly suggest that you take the time to read the Scripting Guide found in the JMP Documentation Library,&amp;nbsp; under the Help pull down menu so you will be able to take this sample code and use it to solve your own scripting needs.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;animals = Open( "$SAMPLE_DATA\Animals.jmp" );
dt_animals = Data Table( "Animals" );

col_list = {"species", "subject", "miles", "season", "name"};
notFound = {};
For( i = 1, i &amp;lt;= N Items( col_list ), i++,
	If( Try( Column( col_list[i] ) &amp;lt;&amp;lt; get name, "" ) == "",
		Insert Into( notFound, col_list[i] )
	)
);

If( N Items( notFound ),
	nf = New Window( "Error:",
		V List Box(
			Text Box( "The following columns are required" ),
			Text Box( "but were not found in the data table" ),
			List Box( notFound )
		)
	);
	throw();
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Sep 2020 12:30:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-column-name-if-existing/m-p/312178#M56513</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-09-24T12:30:17Z</dc:date>
    </item>
  </channel>
</rss>

