選択したデータテーブルの列名を動的に一覧表示する方法は?こんにちは、
Tables-Joinのようなウィンドウを作成しようとしています。2番目のアウトラインボックスでは、選択したデータテーブルの列名を左上隅のリストボックスに動的に一覧表示できます。
よろしくお願いします。
スクリプティングウィンドウズRe:選択したデータテーブルの列名を動的に一覧表示する方法は?こんにちは、
これを行うには、次のようなコードを使用できます。 いくつかのデータテーブルを開いているときに、このコードを実行してみてください。
乾杯、
ブレイディ
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 ) );
)
)
);


Re:選択したデータテーブルの列名を動的に一覧表示する方法は?お返事ありがとうございます。 「collistbox」を「filtercolselector」に置き換えました。期待どおりに機能しません。テーブルを選択するたびに赤い三角形が残り、列リストがそれに応じて更新されません。
'filter colselector'を使用してどのように機能しますか?
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 ) );
)
)
);

Re:選択したデータテーブルの列名を動的に一覧表示する方法は?これをざっと見てみると、Filter ColSelectorを使用するときに注意しなければならないことが2つあります。
- Filter ColSelectorは常にCurrentData table()を使用しているようで、使用するデータテーブルを直接参照することはできません。 Scripting Indexに基づくと、引数としてDatatable(name)を受け入れる必要があるため、おそらくバグです(少なくともJMP16.1では)。
- Filter Col Boxの赤い三角形は、削除する必要のある別のDisplayBoxです。
参照事項を回避するには、ユーザーの選択に基づいてCurrent Data Table()を変更し、赤い三角形も削除してみてください。フィルター列ボックスをVリストボックスにラップして削除できます。
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 ColSelectorの問題を再現するための簡単なスクリプトもあります。
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"))
);Re:選択したデータテーブルの列名を動的に一覧表示する方法は?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)に置き換えれば、機能します。