如何动态列出选定数据表的列名?你好呀,
我正在尝试创建一个类似Tables-Join 的窗口,其中第二个大纲框可以在左上角列表框中动态列出所选数据表的列名称。
先谢谢了。
数据混合和清理大规模定制视窗回复:如何动态列出选定数据表的列名?Names Default To Here(1);
//Open two data tables
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt2 = Open("$SAMPLE_DATA/Consumer Preferences.jmp");
//Make sure the one not used in filter col selector is current data table
Current Data Table(dt2);
wait(0);
//Create filter col selector with non current data table
New Window("Filter Col Selector Example",
fontobj = lb = Filter Col Selector(Data table(dt)) //replace "big class" with dt work.
);将数据表(“big class”)替换为数据表(dt),它可以工作。
回复:如何动态列出选定数据表的列名?快速查看一下,使用 Filter Col Selector 时必须注意两件事:
- 过滤器列选择器似乎总是使用当前数据表(),并且您不能直接引用您要使用的数据表。 根据脚本索引,它应该接受 Datatable(name) 作为参数,因此很可能是一个错误(至少在 JMP16.1 中)。
- Filter Col Box 的红色三角形是一个不同的 DisplayBox,必须删除。
要解决参考问题,您可以尝试根据用户选择更改当前数据表()并删除红色三角形,您可以将 Filter Col Box 包裹在 V List Box 周围并将其删除。
Names Default To Here(1);
//get a list of window names
windows = Get Data Table List();
/*remove ones that are not data tables--need to start at back of list, because its length will change as we delete items
For( i = N Items( windows ), i > 0, i--,
If( (Window( windows[i] ) << Window Class Name) != "DataTable",
Remove From( windows, i )
)
);
*/
//make a dialog window
nw = New Window("Sample",
vlb1 = V List Box(
lb1 = List Box(
windows, //populate the listbox with data table names
//here is the script that runs each time someone clicks in the top box
//delete the current column list box, if it exists
Try(vlb2 << delete);
//append a new v list box which includes filter col selector
Current Data Table(Data Table((lb1 << get selected)[1]));
vlb1 << append(vlb2 = V List Box(Filter Col Selector()));
)
)
);这里还有一个简单的脚本来复制 Filter Col Selector 的问题:
Names Default To Here(1);
//Open two data tables
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt2 = Open("$SAMPLE_DATA/Consumer Preferences.jmp");
//Make sure the one not used in filter col selector is current data table
Current Data Table(dt2);
wait(0);
//Create filter col selector with non current data table
New Window("Filter Col Selector Example",
fontobj = lb = Filter Col Selector(Data table("Big Class"))
);回复:如何动态列出选定数据表的列名?感谢你的回复。 我将“列列表框”替换为“过滤列选择器”,它无法按预期工作,每次选择表格时都会留下一个红色三角形,列列表不会相应更新。
使用“过滤器选择器”是如何工作的?
Names Default To Here( 1 );
//get a list of window names
windows = Get Data Table List();
/*remove ones that are not data tables--need to start at back of list, because its length will change as we delete items
For( i = N Items( windows ), i > 0, i--,
If( (Window( windows[i] ) << Window Class Name) != "DataTable",
Remove From( windows, i )
)
);
*/
//make a dialog window
nw = New Window( "Sample",
vlb1 = V List Box(
lb1 = List Box(
windows, //populate the listbox with data table names
//here is the script that runs each time someone clicks in the top box
//delete the current column list box, if it exists
Try( lb2 << delete );
//append a new col list box, with all columns of the data table selected in the listbox
vlb1 << append( lb2 = Filter Col Selector( Data Table( (lb1 << get selected)[1] ), all ) );
)
)
);

回复:如何动态列出选定数据表的列名?你好,
您可以使用如下代码来执行此操作。 当您打开几个数据表时尝试运行此代码。
干杯,
布雷迪
Names Default To Here( 1 );
//get a list of window names
windows = Window() << get window title;
//remove ones that are not data tables--need to start at back of list, because its length will change as we delete items
For( i = N Items( windows ), i > 0, i--,
If( (Window( windows[i] ) << Window Class Name) != "DataTable",
Remove From( windows, i )
)
);
//make a dialog window
nw = New Window( "Sample",
vlb1 = V List Box(
lb1 = List Box(
windows, //populate the listbox with data table names
//here is the script that runs each time someone clicks in the top box
//delete the current column list box, if it exists
Try( lb2 << delete );
//append a new col list box, with all columns of the data table selected in the listbox
vlb1 << append( lb2 = Col List Box( Data Table( (lb1 << get selected)[1] ), all ) );
)
)
);

