cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
0 Kudos

Add option to change col list box/filter col selector datatable

From time to time it would be nice to build user-interfaces which allow user to change datatables which will be used (currently my solution to this, is to "never" add option to change data tables). To my knowledge, you currently will have to re-create filter col selector and col list box to change datatables they use.

 

This is what I think you have to do:

View more...
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Probe.jmp", invisible);
dt1 = Open("$SAMPLE_DATA/Big Class.jmp", invisible);
dt2 = Open("$SAMPLE_DATA/Semiconductor Capability.jmp", invisible);

close_dts = Expr(
	Try(Close(dt, no save));
	Try(Close(dt1, no save));
	Try(Close(dt2, no save));
);

change_table = Expr(
	cur_table = (lb << get selected)[1];
		
	// this wont work on filter col box due to ifbox created by it
	clb << Delete Box();
	vlb_clb << Append(clb = Col List Box(Datatable(cur_table), all, numeric, max selected(1), nlines(5), <<Modeling Type({"Continuous"})));
	
	vlb_fcs << Delete Box();
	// for some reason we also seem to need Datatable(Datatable())
	vlb_vlb_fcs << Append(vlb_fcs = V List Box(fcs = Filter Col Selector(Datatable(Datatable(cur_table)))));
);

nw = New Window("Col List Box Example",
	H List Box(
		lb = List Box(Get Data Table List(),
			change_table
		),
		vlb_vlb_fcs = V List Box(vlb_fcs = V List Box(fcs = Filter Col Selector(Datatable(dt)))),
		vlb_clb = V List Box(clb = Col List Box(Datatable(dt), all, numeric, max selected(1), nlines(5), <<Modeling Type({"Continuous"}))),
		Button Box("Close",
			close_dts;
			nw << Close Window;
		)
	)
);
Write();

This is how I would like it to be done:

View more...
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Probe.jmp", invisible);
dt1 = Open("$SAMPLE_DATA/Big Class.jmp", invisible);
dt2 = Open("$SAMPLE_DATA/Semiconductor Capability.jmp", invisible);

close_dts = Expr(
	Try(Close(dt, no save));
	Try(Close(dt1, no save));
	Try(Close(dt2, no save));
);

change_table = Expr(
	cur_table = (lb << get selected)[1];
	fcs << Set Data Table(cur_table);
	clb << Set Data Table(cur_table);
);

nw = New Window("Col List Box Example",
	H List Box(
		lb = List Box(Get Data Table List(),
			change_table
		),
		fcs = Filter Col Selector(Datatable(dt)),
		clb = Col List Box(Datatable(dt), all, numeric, max selected(1), nlines(5), <<Modeling Type({"Continuous"})),
		Button Box("Close",
			close_dts;
			nw << Close Window;
		)
	)
);
Write();

This would eliminate the need for unnecessary display boxes and make the reference changing much simpler.