<?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: Col list box() does not respect data table reference in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83559#M37602</link>
    <description>&lt;P&gt;Not answering your real question, but this works (JMP 14.2 on a Mac):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Table 1",
	Add Rows( 0 ),
	Compress File When Saved( 1 ),
	New Column( "Column 1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	)
);

dtNew = New Table( "Table 2",
	Add Rows( 0 ),
	Compress File When Saved( 1 ),
	New Column( "Column 4",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 5",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 6",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	)
);

new window("Column renamer",
	h list box(
		Panel box("Source table",
			SourceBox = Col List Box(DataTable( "Table 1"),All)
		),
		Panel box("Destination table",
			DestBox = Col List Box(DataTable( "Table 2"),All),
		),
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Nov 2018 14:43:27 GMT</pubDate>
    <dc:creator>ian_jmp</dc:creator>
    <dc:date>2018-11-16T14:43:27Z</dc:date>
    <item>
      <title>Col list box() does not respect data table reference</title>
      <link>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83558#M37601</link>
      <description>&lt;P&gt;Using JMP 14.1:&lt;/P&gt;&lt;P&gt;I want people to select two data tables and then display the columns in those datatables in two col list boxes. However when I set the columns in the boxes, JMP will only set the columns from the active data table and will not respect the data table argument. Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a quick example of the wrong behavior:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Table 1",
	Add Rows( 0 ),
	Compress File When Saved( 1 ),
	New Column( "Column 1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	)
);

dtNew = New Table( "Table 2",
	Add Rows( 0 ),
	Compress File When Saved( 1 ),
	New Column( "Column 4",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 5",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 6",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	)
);

new window("Column renamer",
	h list box(
		Panel box("Source table",
			SourceBox = Col List Box(dt,All)
		),
		Panel box("Destination table",
			DestBox = Col List Box(dtnew,All),
		),
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This results is:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 419px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/14369iBAEE2B654FEE6791/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The expected result is that in the left list the columns 1,2,3 are shown since those are the names in the first table. Instead it is showing the second table (the last created and as such the active table) twice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 13:28:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83558#M37601</guid>
      <dc:creator>pauldeen</dc:creator>
      <dc:date>2018-11-16T13:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Col list box() does not respect data table reference</title>
      <link>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83559#M37602</link>
      <description>&lt;P&gt;Not answering your real question, but this works (JMP 14.2 on a Mac):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Table 1",
	Add Rows( 0 ),
	Compress File When Saved( 1 ),
	New Column( "Column 1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	)
);

dtNew = New Table( "Table 2",
	Add Rows( 0 ),
	Compress File When Saved( 1 ),
	New Column( "Column 4",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 5",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	),
	New Column( "Column 6",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [] )
	)
);

new window("Column renamer",
	h list box(
		Panel box("Source table",
			SourceBox = Col List Box(DataTable( "Table 1"),All)
		),
		Panel box("Destination table",
			DestBox = Col List Box(DataTable( "Table 2"),All),
		),
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 14:43:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83559#M37602</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2018-11-16T14:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Col list box() does not respect data table reference</title>
      <link>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83561#M37604</link>
      <description>&lt;P&gt;Hi Ian, Thanks for your help but indeed it does not solve my problem. Here is a bigger code snippet of what I'm really trying to do. So you select two different tables from the open tables and as you select a different table the column list below it populates with the columns from the selected tables:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);
ListOfOpenTables = sort list(Get Data Table List());
ColumnWidth = 300;

new window("Column renamer",
	h list box(
		Panel box("Source table",
			v list box(
				FirstDT = List box(ListOfOpenTables, maxSelected(1), width(ColumnWidth),
					dt = Data Table((FirstDT &amp;lt;&amp;lt; get selected())[1]);
					SourceBox &amp;lt;&amp;lt; Set items(Data Table((FirstDT &amp;lt;&amp;lt; get selected())[1]) &amp;lt;&amp;lt; Get Column Names("String"));
				),
				SourceBox = Col List Box(,nlines(40), width(ColumnWidth),
					OldCounter &amp;lt;&amp;lt; set text(char(n items(SourceBox &amp;lt;&amp;lt; get selected())) || " Columns selected");
					dt &amp;lt;&amp;lt; Select columns(SourceBox &amp;lt;&amp;lt; get selected());
				),
				OldCounter = Text Box("")
			)
		),
		Panel box("Destination table",
			v list box(
				SecondDT = List box(ListOfOpenTables, maxSelected(1), width(ColumnWidth),
					dtnew = Data Table((SecondDT &amp;lt;&amp;lt; get selected())[1]);
					DestBox &amp;lt;&amp;lt; Set items(Data Table((SecondDT &amp;lt;&amp;lt; get selected())[1]) &amp;lt;&amp;lt; Get Column Names("String"));
				),
				DestBox = Col List Box(,nlines(40), width(ColumnWidth),
					NewCounter &amp;lt;&amp;lt; set text(char(n items(DestBox &amp;lt;&amp;lt; get selected())) || " Columns selected");
					dtnew &amp;lt;&amp;lt; Select columns(DestBox &amp;lt;&amp;lt; get selected())
				),
				NewCounter = Text Box("")
			)
		),
		Panel box("Actions",
			v list box(
				button box("Change column names",DoTheWork),
				button box("Undo",Undo)
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Nov 2018 15:12:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83561#M37604</guid>
      <dc:creator>pauldeen</dc:creator>
      <dc:date>2018-11-16T15:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: Col list box() does not respect data table reference</title>
      <link>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83574#M37611</link>
      <description>&lt;P&gt;Sorry Paul, I didn't have the time to understand the nuances of what you are trying to do.&lt;/P&gt;
&lt;P&gt;But here's an old code snippet that may get you closer (not using 'ColListBox()'):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);

ListOfOpenTables = sort list(Get Data Table List());

updateCLB = 
Expr(
	thisTable = (tlb &amp;lt;&amp;lt; getSelected)[1];
	CMD = Expr(cols = DataTable(tableTBD) &amp;lt;&amp;lt; getColumnNames("String"));
	SubstituteInto(CMD, Expr(tableTBD), Eval(thisTable));
	CMD;
	clb &amp;lt;&amp;lt; setItems(cols);
	);

clbAction =
Expr(
	Speak("Column "||(clb &amp;lt;&amp;lt; getSelected)[1]||" was selected.");
	);

nw = NewWindow("Test",
			tlb = ListBox(ListOfOpenTables, maxSelected(1), updateCLB),
			clb = ListBox({"Pick a table above"}, maxSelected(1), clbAction)	
		);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Nov 2018 16:05:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83574#M37611</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2018-11-16T16:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Col list box() does not respect data table reference</title>
      <link>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83585#M37621</link>
      <description>Yeah, with using a standard list box I got it to work, but it doesn't look like column selection dialogs that JMP normally uses. And it doesn't show column grouping from your data table. Hence I would like to implement it with the col list box :)&lt;/img&gt;</description>
      <pubDate>Fri, 16 Nov 2018 16:41:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83585#M37621</guid>
      <dc:creator>pauldeen</dc:creator>
      <dc:date>2018-11-16T16:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Col list box() does not respect data table reference</title>
      <link>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83592#M37626</link>
      <description>&lt;P&gt;Understood! You can do a similar thing with 'ColListBox()' if you prefer:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);

ListOfOpenTables = sort list(Get Data Table List());

updateCLB = 
Expr(
	Try(clb &amp;lt;&amp;lt; delete);
	thisTable = (tlb &amp;lt;&amp;lt; getSelected)[1];
	CMD = Expr(nw &amp;lt;&amp;lt; Append(clb = ColListBox(DataTable(tableTBD), All, maxSelected(1), clbAction)));
	SubstituteInto(CMD, Expr(tableTBD), Eval(thisTable));
	CMD;
	);

clbAction =
Expr(
	Speak("Column "||(clb &amp;lt;&amp;lt; getSelected)[1]||" was selected.");
	);

nw = NewWindow("Test", tlb = ListBox(ListOfOpenTables, maxSelected(1), updateCLB));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 17:00:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Col-list-box-does-not-respect-data-table-reference/m-p/83592#M37626</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2018-11-16T17:00:51Z</dc:date>
    </item>
  </channel>
</rss>

