I 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?