<?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: Generating Columns with a for loop in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Generating-Columns-with-a-for-loop/m-p/77385#M36171</link>
    <description>&lt;P&gt;Again, make the table first and then add the columns.&amp;nbsp; Here is some code that does what you want (I think):&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 );

//Make the data table
dt = New Table( "Tokens",
	Add Rows( 3 ),
	New Column( "Visual_ID", Character, Nominal, Set Values( {"88", "89", "94"} ) ),
	New Column( "FF", Character, Nominal, Set Values( {"Y83", "YA8", "654"} ) ),
	New Column( "Bipping",
		Character,
		Nominal,
		Set Selected,
		Set Values(
			{"19|19|19|16|14|16|19|18|18|21|17|20|20|19|19|20|17|18|18",
			"19|19|19|16|14|16|19|18|18|21|17|20|20|19|19|20|18|18|18",
			"19|18|18|18|17|18|16|18|18|19|21|19|19|18|18|17|16|16|17"}
		)
	)
);

//Then add columns to it.
For( ii = 1, ii&amp;lt;19, ii++, 
	dt &amp;lt;&amp;lt; New Column  ("My_Column_" || Char(ii), 
		Character, 
		Nominal, 
		Formula(
				Word( ii, As Column( Column( "Bipping"  ) ), "|" )
			
				)
			
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 02 Oct 2018 11:35:44 GMT</pubDate>
    <dc:creator>ih</dc:creator>
    <dc:date>2018-10-02T11:35:44Z</dc:date>
    <item>
      <title>Generating Columns with a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Generating-Columns-with-a-for-loop/m-p/77371#M36167</link>
      <description>&lt;P&gt;Hello, I try to generate several columns with the next JSL script line but when running the script the data table is blank:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	For(i=0,i&amp;lt;3,i++,New Column( "A", Numeric, Continuous, Format( "Best", 10 ), Set Values( [1, 2, 3, .] )))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How can it be fixed?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 08:17:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Generating-Columns-with-a-for-loop/m-p/77371#M36167</guid>
      <dc:creator>axcelenator1</dc:creator>
      <dc:date>2018-10-02T08:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Generating Columns with a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Generating-Columns-with-a-for-loop/m-p/77383#M36169</link>
      <description>&lt;P&gt;The syntax looks correct so I suspect the issue is with the context that you are using it.&amp;nbsp; To make this work, first create a table and then your add new columns.&amp;nbsp; To ensure columns are created in the correct table, make a reference to that table and 'send' the New Column message to it, as shown below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here( 1 );

//Open a blank table and save a reference to it
dt = New Table( "New Table", Add Rows( 0 ) );

//Add columns to the table
For( i=0, i&amp;lt;3, i++,
	dt &amp;lt;&amp;lt; New Column( "A", Numeric, Continuous, Format( "Best", 10 ), Set Values( [1, 2, 3, .] ))
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Oct 2018 11:21:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Generating-Columns-with-a-for-loop/m-p/77383#M36169</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2018-10-02T11:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Generating Columns with a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Generating-Columns-with-a-for-loop/m-p/77384#M36170</link>
      <description>&lt;P&gt;Can you look here please:&amp;nbsp;&lt;A href="https://community.jmp.com/t5/Discussions/Loop-is-not-working/m-p/77361#M36165" target="_blank"&gt;https://community.jmp.com/t5/Discussions/Loop-is-not-working/m-p/77361#M36165&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;In the above link I try to make something similar but it not works&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 11:27:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Generating-Columns-with-a-for-loop/m-p/77384#M36170</guid>
      <dc:creator>axcelenator1</dc:creator>
      <dc:date>2018-10-02T11:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Generating Columns with a for loop</title>
      <link>https://community.jmp.com/t5/Discussions/Generating-Columns-with-a-for-loop/m-p/77385#M36171</link>
      <description>&lt;P&gt;Again, make the table first and then add the columns.&amp;nbsp; Here is some code that does what you want (I think):&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 );

//Make the data table
dt = New Table( "Tokens",
	Add Rows( 3 ),
	New Column( "Visual_ID", Character, Nominal, Set Values( {"88", "89", "94"} ) ),
	New Column( "FF", Character, Nominal, Set Values( {"Y83", "YA8", "654"} ) ),
	New Column( "Bipping",
		Character,
		Nominal,
		Set Selected,
		Set Values(
			{"19|19|19|16|14|16|19|18|18|21|17|20|20|19|19|20|17|18|18",
			"19|19|19|16|14|16|19|18|18|21|17|20|20|19|19|20|18|18|18",
			"19|18|18|18|17|18|16|18|18|19|21|19|19|18|18|17|16|16|17"}
		)
	)
);

//Then add columns to it.
For( ii = 1, ii&amp;lt;19, ii++, 
	dt &amp;lt;&amp;lt; New Column  ("My_Column_" || Char(ii), 
		Character, 
		Nominal, 
		Formula(
				Word( ii, As Column( Column( "Bipping"  ) ), "|" )
			
				)
			
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Oct 2018 11:35:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Generating-Columns-with-a-for-loop/m-p/77385#M36171</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2018-10-02T11:35:44Z</dc:date>
    </item>
  </channel>
</rss>

