<?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: Creating A column in new table, filling with value under one condition, and another if otherwise in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Creating-A-column-in-new-table-filling-with-value-under-one/m-p/592742#M79670</link>
    <description>&lt;P&gt;I would change the code a bit, and not place the IF() into a column formula, but rather, do the comparison in open code, and then create the column based upon the results of the IF().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Try( Data Table( "Counter Bin Summary" ):"N(4)"n &amp;lt;&amp;lt; get name, "" ) != "",
	theValues = Data Table( "Counter Bin Summary" ):"N(4)"n &amp;lt;&amp;lt; get values;
	Data Table( "New Table" ) &amp;lt;&amp;lt; New Column( "N(4)" );
	Data Table( "New Table" ):"N(4)"n &amp;lt;&amp;lt; set values( theValues );
,
	Data Table( "New Table" ) &amp;lt;&amp;lt; New Column( "N(4)", set each value( 0 ) )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please note that I am referencing your new table by the name "New Table"&amp;nbsp; This needs to be changed to whatever the new tables name actually is.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jan 2023 17:28:22 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2023-01-24T17:28:22Z</dc:date>
    <item>
      <title>Creating A column in new table, filling with value under one condition, and another if otherwise</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-A-column-in-new-table-filling-with-value-under-one/m-p/592704#M79667</link>
      <description>&lt;P&gt;Hi all, building my own table from a number of others, and making a column that I want to have fixed length. If a column exists from another table, I wish to fill it with values made from a list , if not, i wish to fill it with zeroes. Currently, there are no values appearing and I cannot figure out a place to put the if statements that will make this work out. This is my most recent attempt, Idea is to fill with values from the array N_4, which is populated if that column name exists, else fill with zeroes, but I'm not sure if this is the correct way to do it, any pointers would be welcomed!&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Column( "N(4)",Numeric, formula(If( Contains( Data Table( "Counter Bin Summary" ) &amp;lt;&amp;lt; get column names( string ), "N(4)" ) ,Values(N_4),Set Each Value (0)) )),
	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:41:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-A-column-in-new-table-filling-with-value-under-one/m-p/592704#M79667</guid>
      <dc:creator>OC200m</dc:creator>
      <dc:date>2023-06-08T16:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating A column in new table, filling with value under one condition, and another if otherwise</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-A-column-in-new-table-filling-with-value-under-one/m-p/592742#M79670</link>
      <description>&lt;P&gt;I would change the code a bit, and not place the IF() into a column formula, but rather, do the comparison in open code, and then create the column based upon the results of the IF().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Try( Data Table( "Counter Bin Summary" ):"N(4)"n &amp;lt;&amp;lt; get name, "" ) != "",
	theValues = Data Table( "Counter Bin Summary" ):"N(4)"n &amp;lt;&amp;lt; get values;
	Data Table( "New Table" ) &amp;lt;&amp;lt; New Column( "N(4)" );
	Data Table( "New Table" ):"N(4)"n &amp;lt;&amp;lt; set values( theValues );
,
	Data Table( "New Table" ) &amp;lt;&amp;lt; New Column( "N(4)", set each value( 0 ) )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please note that I am referencing your new table by the name "New Table"&amp;nbsp; This needs to be changed to whatever the new tables name actually is.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 17:28:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-A-column-in-new-table-filling-with-value-under-one/m-p/592742#M79670</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-01-24T17:28:22Z</dc:date>
    </item>
  </channel>
</rss>

