<?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: Scripting to skip changing a column if the column is not present in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Scripting-to-skip-changing-a-column-if-the-column-is-not-present/m-p/34175#M20265</link>
    <description>That second piece of scripting works perfectly, thank you very much!</description>
    <pubDate>Fri, 06 Jan 2017 09:59:58 GMT</pubDate>
    <dc:creator>Joe</dc:creator>
    <dc:date>2017-01-06T09:59:58Z</dc:date>
    <item>
      <title>Scripting to skip changing a column if the column is not present</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-to-skip-changing-a-column-if-the-column-is-not-present/m-p/34115#M20227</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way in which a piece of script can automatically be ignored if the targeted&amp;nbsp;column&amp;nbsp;is not present? For example I have the scripting shown below, and sometimes there is not a "Numerical C" available (It is a piece of automation which may or may not have 3 variables). The script currently stalls on this piece when there is no "Numerical C" to be found; ideally I will be wanting to make a script with multiple "Numerical #" which will automatically ignore that piece of the script if it is not present:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Data Table&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;"Jan 5 Subset"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Column&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Column"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Data Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Numeric&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Column&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Column"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Modeling Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Continuous&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Column&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Data"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Data Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Numeric&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Column&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Data"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Modeling Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Continuous&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Column&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Numerical A"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Data Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Numeric&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Column&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Numerical A"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Modeling Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Continuous&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Column&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Numerical B"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Data Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Numeric&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Column&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Numerical B"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Modeling Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Continuous&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Column&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Numerical C"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Data Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Numeric&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Column&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Numerical C"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Modeling Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Continuous&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks you,&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 16:30:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-to-skip-changing-a-column-if-the-column-is-not-present/m-p/34115#M20227</guid>
      <dc:creator>Joe</dc:creator>
      <dc:date>2017-01-05T16:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting to skip changing a column if the column is not present</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-to-skip-changing-a-column-if-the-column-is-not-present/m-p/34119#M20229</link>
      <description>&lt;P&gt;There are a couple of ways that I do this......&lt;/P&gt;
&lt;P&gt;The first is to place the statements that need to be qualified, in an IF function.&amp;nbsp; The most formal of this would be to get the column names from the data table, and then base the IF condition on if the column was found&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Data Table( "Jan 5 Subset" );
If( Contains( dt &amp;lt;&amp;lt; get column names( string ), "Column" ),
	Column( "Column" ) &amp;lt;&amp;lt; Data Type( Numeric ) &amp;lt;&amp;lt; Modeling Type( Continuous )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The second method is to let JMP egnore any errors it finds by using a Try function&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Try( Column( "Column" ) &amp;lt;&amp;lt; Data Type( Numeric ) &amp;lt;&amp;lt; Modeling Type( Continuous ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The statement&amp;nbsp;may fail, but JMP will continue execution&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 16:46:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-to-skip-changing-a-column-if-the-column-is-not-present/m-p/34119#M20229</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-01-05T16:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting to skip changing a column if the column is not present</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-to-skip-changing-a-column-if-the-column-is-not-present/m-p/34174#M20264</link>
      <description>&lt;P&gt;Hi Jim,&lt;BR /&gt;&lt;BR /&gt;Thanks for the fast reply. I have tried the top function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;dt &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Data Table&lt;/SPAN&gt;( &lt;SPAN class="token string"&gt;"Jan 5 Subset"&lt;/SPAN&gt; );&lt;BR /&gt;&lt;SPAN class="token function"&gt;If&lt;/SPAN&gt;( &lt;SPAN class="token function"&gt;Contains&lt;/SPAN&gt;( dt &lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt; get &lt;SPAN class="token function"&gt;column&lt;/SPAN&gt; names( string ), &lt;SPAN class="token string"&gt;"Column"&lt;/SPAN&gt; ),&lt;BR /&gt;&lt;SPAN class="token function"&gt;Column&lt;/SPAN&gt;( &lt;SPAN class="token string"&gt;"Column"&lt;/SPAN&gt; ) &lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt; Data &lt;SPAN class="token function"&gt;Type&lt;/SPAN&gt;( Numeric ) &lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt; Modeling &lt;SPAN class="token function"&gt;Type&lt;/SPAN&gt;( Continuous )&lt;BR /&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;However I am not sure what to put where "(string)" is in the script?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;At the moment&lt;FONT face="arial,helvetica,sans-serif"&gt; the script appears to be failing on this line with "Send Expects Scriptable Object". My current scripting for this would be:&lt;/FONT&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000dd" face="Courier New" size="2"&gt;IF&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000dd" face="Courier New" size="2"&gt;Contains&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;dt &lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;Get column names&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;string&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;,&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;"Numerical A"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Numerical A"&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Data Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Numeric&lt;STRONG&gt;)&lt;/STRONG&gt; &lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&amp;lt;&amp;lt;&lt;STRONG&gt;Modeling Type&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;(&lt;/STRONG&gt;Continuous&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif" size="3"&gt;Apologies if there is something really obvious that I am missing here, thanks in advance.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2017 08:53:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-to-skip-changing-a-column-if-the-column-is-not-present/m-p/34174#M20264</guid>
      <dc:creator>Joe</dc:creator>
      <dc:date>2017-01-06T08:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting to skip changing a column if the column is not present</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-to-skip-changing-a-column-if-the-column-is-not-present/m-p/34175#M20265</link>
      <description>That second piece of scripting works perfectly, thank you very much!</description>
      <pubDate>Fri, 06 Jan 2017 09:59:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-to-skip-changing-a-column-if-the-column-is-not-present/m-p/34175#M20265</guid>
      <dc:creator>Joe</dc:creator>
      <dc:date>2017-01-06T09:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting to skip changing a column if the column is not present</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-to-skip-changing-a-column-if-the-column-is-not-present/m-p/34185#M20267</link>
      <description>&lt;P&gt;Here is a script that takes what you said that you had tried, and corrects it so that it should work.&amp;nbsp; I have also annotated the script to help understand what each statement is doing&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Set a variable "dt" to point to the data table you want to work on
// In the example you showed, it was a table called "Jan 5 Subset"
dt = Data Table("Jan 5 Subset");

// Now request to get from the data table, now referenced by the 
// variable "dt" and return the list as strings
// Using the Contains function, we will check to see if a column
// named "Numerical A" is found in the returned list of column 
// names.  If it is, the comparison will be true and the statements
// following the "," will be executed
IF( Contains(dt &amp;lt;&amp;lt; Get column names(string), "Numerical A"),
	// Set the Data Type and Modeling Type for the column "Numerical A"
	Column("Numerical A") &amp;lt;&amp;lt;Data Type (Numeric) &amp;lt;&amp;lt;Modeling Type (Continuous);
// close the IF function
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Jan 2017 13:25:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-to-skip-changing-a-column-if-the-column-is-not-present/m-p/34185#M20267</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-01-06T13:25:18Z</dc:date>
    </item>
  </channel>
</rss>

