<?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 Creating a list of Column References in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Creating-a-list-of-Column-References/m-p/53942#M30473</link>
    <description>&lt;P&gt;I am trying to make a list of column references to later use in making a stacked data table.&lt;/P&gt;&lt;P&gt;When I make the list inside a function it works perfectly fine.&amp;nbsp; However, when I try the same inside a class method it does not work yielding the error message:&amp;nbsp;"No value to Op Assign"(1, 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;make_col_list = Function({dt,start,end},
	Local({lst,col_list},
		Try(
			Current Data Table(dt);
			col_list = {};
			lst = dt &amp;lt;&amp;lt; Get Column Names;
			For(i=start,i&amp;lt;=end,i++,
				Insert Into(col_list,lst[i])
			);
		,
			Throw("Error in col_list: "||char(exception_msg))
		);
		col_list;
	);
);&lt;/PRE&gt;&lt;P&gt;Above is the function I use in one script.&amp;nbsp; This function currently works no issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try a similar idea inside of a class however it will not work.&amp;nbsp; Below is how I have it defined inside&amp;nbsp;of the class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;col_list = dt &amp;lt;&amp;lt; Get Column Names;
show(col_list);
show(col_list[26]);
Try(
	For(pv_i=27,pv_i&amp;lt;=696,i++,
		show(col_list[pv_i]);
		Insert Into(pv_lst,col_list[pv_i]);
	);
,
	Throw("Error in pv columns: "||Char(exception_msg));
);
Try(
	For(zv_i=16,zv_i&amp;lt;=25,zv_i++,
		Insert Into(zv_lst,col_list[zv_i]);
	);
,
	Throw("Error in zv columns: "||Char(exception_msg));
);
Try(
	For(wr_i=26,wr_i&amp;lt;=361,wr_i++,
		Insert Into(wr_lst,col_list[wr_i]);
	);
,
	Throw("Error in work columns: "||Char(exception_msg));
);
Try(
	For(dr_i=362,dr_i&amp;lt;=696,dr_i++,
		Insert Into(dr_lst,col_list[dr_i]);
	);
,
	Throw("Error in drive columns: "||Char(exception_msg));
);&lt;/PRE&gt;&lt;P&gt;I have multiple groups of columns I am trying to select and manipulate.&lt;/P&gt;&lt;P&gt;I originally tried to use a method like this:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;pv_lst = Column(26::696);&lt;/PRE&gt;&lt;P&gt;but was unable to get this to work either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help in how to properly generate a list or collection of column references would be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Mar 2018 16:12:54 GMT</pubDate>
    <dc:creator>awsmagala</dc:creator>
    <dc:date>2018-03-27T16:12:54Z</dc:date>
    <item>
      <title>Creating a list of Column References</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-list-of-Column-References/m-p/53942#M30473</link>
      <description>&lt;P&gt;I am trying to make a list of column references to later use in making a stacked data table.&lt;/P&gt;&lt;P&gt;When I make the list inside a function it works perfectly fine.&amp;nbsp; However, when I try the same inside a class method it does not work yielding the error message:&amp;nbsp;"No value to Op Assign"(1, 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;make_col_list = Function({dt,start,end},
	Local({lst,col_list},
		Try(
			Current Data Table(dt);
			col_list = {};
			lst = dt &amp;lt;&amp;lt; Get Column Names;
			For(i=start,i&amp;lt;=end,i++,
				Insert Into(col_list,lst[i])
			);
		,
			Throw("Error in col_list: "||char(exception_msg))
		);
		col_list;
	);
);&lt;/PRE&gt;&lt;P&gt;Above is the function I use in one script.&amp;nbsp; This function currently works no issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try a similar idea inside of a class however it will not work.&amp;nbsp; Below is how I have it defined inside&amp;nbsp;of the class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;col_list = dt &amp;lt;&amp;lt; Get Column Names;
show(col_list);
show(col_list[26]);
Try(
	For(pv_i=27,pv_i&amp;lt;=696,i++,
		show(col_list[pv_i]);
		Insert Into(pv_lst,col_list[pv_i]);
	);
,
	Throw("Error in pv columns: "||Char(exception_msg));
);
Try(
	For(zv_i=16,zv_i&amp;lt;=25,zv_i++,
		Insert Into(zv_lst,col_list[zv_i]);
	);
,
	Throw("Error in zv columns: "||Char(exception_msg));
);
Try(
	For(wr_i=26,wr_i&amp;lt;=361,wr_i++,
		Insert Into(wr_lst,col_list[wr_i]);
	);
,
	Throw("Error in work columns: "||Char(exception_msg));
);
Try(
	For(dr_i=362,dr_i&amp;lt;=696,dr_i++,
		Insert Into(dr_lst,col_list[dr_i]);
	);
,
	Throw("Error in drive columns: "||Char(exception_msg));
);&lt;/PRE&gt;&lt;P&gt;I have multiple groups of columns I am trying to select and manipulate.&lt;/P&gt;&lt;P&gt;I originally tried to use a method like this:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;pv_lst = Column(26::696);&lt;/PRE&gt;&lt;P&gt;but was unable to get this to work either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help in how to properly generate a list or collection of column references would be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 16:12:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-list-of-Column-References/m-p/53942#M30473</guid>
      <dc:creator>awsmagala</dc:creator>
      <dc:date>2018-03-27T16:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list of Column References</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-list-of-Column-References/m-p/53950#M30480</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11382"&gt;@awsmagala&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;It sounds like you are trying to do something relatively simple in a very complicated way.&amp;nbsp;&amp;nbsp;You can do a table stack with a list of column numbers instead of the explicit column names.&amp;nbsp; For example, I can stack all the numeric columns in Car Physical Data (sample data table) the usual way like so:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "Car Physical Data" ) &amp;lt;&amp;lt; Stack(
	columns( :Weight, :Turning Circle, :Displacement, :Horsepower, :Gas Tank Size ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" )
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or in the columns argument, I can do this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;stack_cols = 4::8;

Data Table( "Car Physical Data" ) &amp;lt;&amp;lt; Stack(
	columns( stack_cols ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If the columns you want to stack are not all together, you can just concatenate the chunks of column numbers together.&amp;nbsp; Hopefully that helps.&lt;/P&gt;&lt;P&gt;Also, if you want to get the actual column names in a range, you could really shorten that make_col_list function to something like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;col_names = (dt &amp;lt;&amp;lt; Get Column Names)[start::end]&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Mar 2018 18:02:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-list-of-Column-References/m-p/53950#M30480</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-03-27T18:02:54Z</dc:date>
    </item>
  </channel>
</rss>

