Column Selection issueI am creating a visualization, storing all open file names in a listbox. I then want to select a specific file and display all numeric columns from that file into a colListBox. Oddly, this seems to work only for a file I created myself and not for two additional files from the sample directory. I tried setting the table of choice to the 'current datatable' but I am unable to figure out how to switch columns when I switch table.
Currently it loads the columns for my defects.jmp table and not the others.
ns = newNameSpace();
// Get some Data
dt1 = Open( "$SAMPLE_DATA/Big Class.jmp" ); // JMP Library.
dt1 = Open( "$SAMPLE_DATA/Football.jmp" ); // JMP Library.
dt1 = Open( "defects.jmp" ); // Troy Local File.
// Get a list of open files
openDTs = {};
for(i=1, i<= nTable(), i++,
insertInto(openDTs, dataTable(i))
);
// Create File and Column Selector
selectionWindow = newWindow("Col Selection Test",
ns:tableBox = listBox("", << setwidth(200), << setNLines(5), maxSelected(1),
selectedTable = (ns:tableBox << getSelected)[1];
currentDatatable(dataTable(selectedTable));
colList = dataTable(selectedTable) << getColumnNames("Numeric");
show(colList);
ns:columnBox << setItems(colList);
);
ns:tableBox << setItems(openDTs);
ns:columnBox = colListBox({}, width(177), << setNLines(5), maxSelected(1));
hListBox(ns:tableBox, ns:columnBox);
);
When I select 'defects' I get the following which is the desired result

However, subsequent selections of the other tables do not populate the columns

defects.jmp table

I've tried various options but nothing seems to work??? Weird.
Any suggestions?
Automation and ScriptingRe: Column Selection issueYou will have to replace Col List Box as it will refer to specific data table
Names Default To Here(1);
ns = New Namespace();
Open("$SAMPLE_DATA/Big Class.jmp");
Open("$SAMPLE_DATA/Football.jmp");
Open("$SAMPLE_DATA/Cars.jmp");
dts = Get Data Table List() << get name;
selectionWindow = New Window("Col Selection Test",
H List Box(
lb = List Box(
dts,
<< Set Width(200),
<< Set NLines(5),
maxSelected(1),
sel_vals = lb << Get Selected;
If(N Items(sel_vals) > 0,
(clb_collector << Child) << Delete Box();
clb_collector << Append(
clb = Col List Box(Datatable(sel_vals[1]),
<< Set Items(Data Table(sel_vals[1]) << Get Column Names("Numeric", "String")),
<< Set Data Type("Numeric"),
width(177),
<<SETNLINES></SETNLINES>Re: Column Selection issueAwesome, thanks Jarmo.
Delete and re-append. Why didn't I think of that.
Also, I wasn't aware of function 'Get Data Table List()' which is very handy 
Thanks for the quick reply.