列のプロパティで列を並べ替えるこんにちは、JMP コミュニティです。
列のプロパティで列を並べ替える方法はありますか?
列に「テスト番号」プロパティが含まれるデータテーブルがあります(以下を参照)。
列グループ「テスト」内のすべての列を列プロパティ「テスト番号」で並べ替えたいと考えています。
以下にデータ表を添付しました。 助言がありますか?

ありがとう、ジャッキー!
自動化とスクリプト作成Re: 列のプロパティで列を並べ替えるこんにちは@ジャッキー_ 、
このようなものがあなたの望みどおりに機能することを期待しています。 構文はおそらく間違っていますが、考え方は正しいです。 連想配列を使用すると、本質的にエントリが昇順/アルファベット順に自動的に並べ替えられるため、これが最も簡単な方法であると私は考えています。
私が去ったことに注意してくださいgroup_tests_cols空。 それらを「テスト」にグループ化していることがわかります。そのため、リスト、またはすべての列名を取得してリストを作成するメソッドがあるはずです。
Names default to here(1);
dt = current data table();
group_tests_cols = { };
// automatically sorts key data in ascending / alphabetical order
aa_tests_cols = Associative Array();
// Puts all of the test numbers as the keys in the AA
for( a = 1, a <= N Items( group_tests_cols ), a++,
test_number = column( dt, group_tests_cols[a] ) << Get Property( "Formula" );
eval( eval expr( aa_tests_cols[ expr( test_number ) ] ) ) = group_tests_cols[a];
);
aa_keys = aa_tests_cols << Get keys;
// Moves columns in the order of the keys
for( b = 1, b <= N Items( aa_keys ), b++,<BR /> col_name = aa_tests_cols[ aa_keys[b] ]; // uses index of the key to retrieve the actual value of the key, to get the col name
eval( eval expr( expr( column( dt, col_name ) ) << Move Selected Columns( expr( { as column( col_name ) } ), after( :name ) ) ) );
);
Re: 列のプロパティで列を並べ替える以下は、テスト番号の値を検索し、それらに基づいて列を順序付ける作業スクリプトです。
Names Default To Here( 1 );
dt = Current Data Table();
//Get the test numbers and the column names associated with them
valList = {};
testList = {};
For Each( {col}, dt << get column group( "Tests" ),
Show( col );
Insert Into( valList, Num( col << get property( "Test Number" ) ) );
Insert Into( testList, Char( col << get name ) );
);
// Sort the test numbers
sortedList = Sort List( valList );
// Loop through the test orders and reorder the columns
For Each( {test, index}, sortedList,
theCol = Contains( valList, sortedList[N Items( sortedList ) + 1 - index] );
dt << go to( testList[theCol] );
dt << Move Selected Columns( To first );
);
他の人がこのタスクを達成するためのより良い方法を持っているかもしれません
Re: 列のプロパティで列を並べ替えるありがとう、ジム!
Re: 列のプロパティで列を並べ替えるこれはJMP17より前のバージョンで機能すると思います
Names Default To Here( 1 );
dt = Current Data Table();
aa = Associative Array();
For Each({col}, dt << get column group("Tests"),
aa[col << get name] = Num(col << get property("Test Number"));
);
Eval(EvalExpr(
dt << Move Selected Columns(Expr((aa << get keys)[Rank(aa << get values)]), To last)
));
JMP17 (少なくとも JMP17.0) では、選択した列の移動の動作が (偶然) 変更されました。選択した列の移動がリストで機能する理由が JMP17 で変更された理由はありますか?
Re: 列のプロパティで列を並べ替えるありがとう、ジャーモ!
Re: 列のプロパティで列を並べ替える@jthi JMP 17 を使用しているのですが、移動選択が機能しません。
複数の「選択した列を移動」コマンドは、次のように堅牢ではありません。選択した列の移動がリストで機能する理由が JMP17 で変更された理由はありますか?
これに対して提案できる回避策は次のとおりです。
Names Default To Here( 1 );
dt = Current Data Table();
aa = Associative Array();
For Each({col}, dt << get column group("Tests"),
aa[col << get name] = Num(col << get property("Test Number"));
);
Eval(EvalExpr(
dt << Move Selected Columns(Expr((aa << get keys)[Rank(aa << get values)]), To last)
));
Re: 列のプロパティで列を並べ替えるループ内で選択した列を複数移動すると機能するはずです。 最初に列の順序付けリストを作成し、それに応じてループするだけです。