<?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 Add columns by refering to column number in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Add-columns-by-refering-to-column-number/m-p/17870#M16295</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to add columns together by refereing to the columns numbers instead of their names. Here is an example of what I worte so far&lt;/P&gt;&lt;P style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;dt = Current Data Table();&lt;/P&gt;&lt;P style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;dt &amp;lt;&amp;lt; New Column("Luq", Numeric, continuos, Format ("Best", 5), &amp;lt;&amp;lt; Set Each Value (2));&lt;/P&gt;&lt;P style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;dt &amp;lt;&amp;lt; New Column("Fin", Numeric, continuos, Format ("Best", 5), &amp;lt;&amp;lt; Set Each Value (3));&lt;/P&gt;&lt;P dir="ltr" style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;dt &amp;lt;&amp;lt; New Column("Final Result", Numeric, continous, Format("Best", 5 ), Formula ( Add Columns ({6,7})), &amp;lt;&amp;lt; Add Column properties(Set property ("Value Colors", {if (:Final Result &amp;gt;= 9 = 3,&amp;nbsp; &lt;SPAN style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;:Final Result&lt;/SPAN&gt; &amp;gt;= 5 = 9, &lt;SPAN style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;:Final Result&lt;/SPAN&gt; &amp;lt;5 = 4 )}), Color Cell by Value));&lt;/P&gt;&lt;P dir="ltr" style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;&lt;/P&gt;&lt;P dir="ltr" style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;You can also see that I am trying to color the columns by their value number. What I want to code is "if that the value is greater than 9 color RED, if it is greater that 5 color YELLOW and else color GREEN"&lt;/P&gt;&lt;P dir="ltr" style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;&lt;/P&gt;&lt;P dir="ltr" style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;Thank You.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Apr 2016 16:12:56 GMT</pubDate>
    <dc:creator>luqi</dc:creator>
    <dc:date>2016-04-07T16:12:56Z</dc:date>
    <item>
      <title>Add columns by refering to column number</title>
      <link>https://community.jmp.com/t5/Discussions/Add-columns-by-refering-to-column-number/m-p/17870#M16295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to add columns together by refereing to the columns numbers instead of their names. Here is an example of what I worte so far&lt;/P&gt;&lt;P style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;dt = Current Data Table();&lt;/P&gt;&lt;P style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;dt &amp;lt;&amp;lt; New Column("Luq", Numeric, continuos, Format ("Best", 5), &amp;lt;&amp;lt; Set Each Value (2));&lt;/P&gt;&lt;P style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;dt &amp;lt;&amp;lt; New Column("Fin", Numeric, continuos, Format ("Best", 5), &amp;lt;&amp;lt; Set Each Value (3));&lt;/P&gt;&lt;P dir="ltr" style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;dt &amp;lt;&amp;lt; New Column("Final Result", Numeric, continous, Format("Best", 5 ), Formula ( Add Columns ({6,7})), &amp;lt;&amp;lt; Add Column properties(Set property ("Value Colors", {if (:Final Result &amp;gt;= 9 = 3,&amp;nbsp; &lt;SPAN style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;:Final Result&lt;/SPAN&gt; &amp;gt;= 5 = 9, &lt;SPAN style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;:Final Result&lt;/SPAN&gt; &amp;lt;5 = 4 )}), Color Cell by Value));&lt;/P&gt;&lt;P dir="ltr" style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;&lt;/P&gt;&lt;P dir="ltr" style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;You can also see that I am trying to color the columns by their value number. What I want to code is "if that the value is greater than 9 color RED, if it is greater that 5 color YELLOW and else color GREEN"&lt;/P&gt;&lt;P dir="ltr" style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;&lt;/P&gt;&lt;P dir="ltr" style="color: #000000; font-family: verdana, helvetica, sans-serif; font-size: 13px;"&gt;Thank You.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2016 16:12:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-columns-by-refering-to-column-number/m-p/17870#M16295</guid>
      <dc:creator>luqi</dc:creator>
      <dc:date>2016-04-07T16:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Add columns by refering to column number</title>
      <link>https://community.jmp.com/t5/Discussions/Add-columns-by-refering-to-column-number/m-p/17871#M16296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi luqi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "As Column()" function will help you with adding columns by position in the data table. To add the values in the 6th and 7th columns:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; New Column( "Final Result",&lt;/P&gt;&lt;P&gt;&amp;nbsp; Numeric,&lt;/P&gt;&lt;P&gt;&amp;nbsp; continuous,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Format( "Best", 5 ),&lt;/P&gt;&lt;P&gt;&amp;nbsp; Formula( As Column( column(6) ) + As Column( column(7) ) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the cell coloring you desire, it's easier to accomplish by coloring the cells directly, without a column property:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For( i = 1, i &amp;lt;= N Row( dt ), i++,&lt;/P&gt;&lt;P&gt;&amp;nbsp; If(&lt;/P&gt;&lt;P&gt;&amp;nbsp; Column( dt, "Final Result" )&lt;I&gt; &amp;gt;= 9, Column( dt, "Final Result" ) &amp;lt;&amp;lt; Color Cells( red, {i} ),&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Column( dt, "Final Result" )&lt;I&gt; &amp;gt;= 5, Column( dt, "Final Result" ) &amp;lt;&amp;lt; Color Cells( yellow, {i} ),&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Column( dt, "Final Result" ) &amp;lt;&amp;lt; Color Cells( green, {i} )&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jordan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2016 00:03:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-columns-by-refering-to-column-number/m-p/17871#M16296</guid>
      <dc:creator>Jordan_Hiller</dc:creator>
      <dc:date>2016-04-12T00:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Add columns by refering to column number</title>
      <link>https://community.jmp.com/t5/Discussions/Add-columns-by-refering-to-column-number/m-p/17872#M16297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Luqi,&lt;/P&gt;&lt;P&gt;Jordan's example does work well, but it does have one drawback.&amp;nbsp; The formula created contains the column numbers, not the column names the column numbers refer to.&amp;nbsp; Therefore, you are left with an issue that if you change the structure of the data table, and either move or delete any column before the columns specified in the formula, the formula will change, and base its values on the values of the new columns that are in the number position(s) specified in the formula.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This can be mitigated in a couple of ways.&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; If you delete the formula after you create the new column, it will break the link to the columns specified by number, and change the row values to the static values the formula had determined.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; column(6a0&amp;lt;&amp;lt;delete property("formula");&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; You can use a slightly more complex structure, and force the actual column name into the formula &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000dd; font-family: Consolas; font-size: 10pt;"&gt;Eval&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: Consolas;"&gt;(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000dd; font-family: Consolas; font-size: 10pt;"&gt;Substitute&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: Consolas;"&gt;(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000dd; font-family: Consolas; font-size: 10pt;"&gt;Expr&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: Consolas;"&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt &lt;/SPAN&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;New Column&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN style="color: purple; font-family: Consolas; font-size: 10pt;"&gt;"test2"&lt;/SPAN&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt; formula&lt;STRONG&gt;(&lt;/STRONG&gt; _a_ &lt;/SPAN&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt; _b_ &lt;STRONG&gt;)&lt;/STRONG&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000dd; font-family: Consolas; font-size: 10pt;"&gt;Expr&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: Consolas;"&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt; _a_ &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #0000dd; font-family: Consolas; font-size: 10pt;"&gt;Parse&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: Consolas;"&gt;(&lt;/STRONG&gt; &lt;SPAN style="color: #0000dd; font-family: Consolas; font-size: 10pt;"&gt;Column&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: Consolas;"&gt;(&lt;/STRONG&gt; &lt;STRONG style="color: teal; font-size: 10pt; font-family: Consolas;"&gt;6&lt;/STRONG&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt; &lt;STRONG&gt;)&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; &lt;STRONG style="color: navy; font-size: 10pt; font-family: Consolas;"&gt;get name&lt;/STRONG&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000dd; font-family: Consolas; font-size: 10pt;"&gt;Expr&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: Consolas;"&gt;(&lt;/STRONG&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt; _b_ &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="color: #0000dd; font-family: Consolas; font-size: 10pt;"&gt;Parse&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: Consolas;"&gt;(&lt;/STRONG&gt; &lt;SPAN style="color: #0000dd; font-family: Consolas; font-size: 10pt;"&gt;Column&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: Consolas;"&gt;(&lt;/STRONG&gt; &lt;STRONG style="color: teal; font-size: 10pt; font-family: Consolas;"&gt;7&lt;/STRONG&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt; &lt;STRONG&gt;)&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;SPAN style="color: navy; font-family: Consolas; font-size: 10pt;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; &lt;STRONG style="color: navy; font-size: 10pt; font-family: Consolas;"&gt;get name&lt;/STRONG&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 10pt;"&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: Consolas;"&gt;);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2016 03:38:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-columns-by-refering-to-column-number/m-p/17872#M16297</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2016-04-12T03:38:04Z</dc:date>
    </item>
  </channel>
</rss>

