列を行に転置するJSLスクリプト開始方法がわからない場合は、選択した特定の列を行に自動的に転置するスクリプトのヘルプが必要です。
私は手動でそれを行う方法を知っていますが、これは何百ものデータファイルにとって非常に反復的なタスクであるため、スクリプトが必要です
データのサンプルと望ましい結果については、添付のjmpファイルを参照してください。
私は本当にあなたの助けをいただければ幸いです
データ表スクリプティングRe:列を行に転置するJSLスクリプト以下のスクリプトは、要求した出力テーブルを作成するための良いスタートです。
Names Default To Here( 1 );
dt = Current Data Table();
// Transpose the Demographics
dtTrans1 = dt << Transpose(
columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
Transpose selected rows only( 1 ),
Output Table( "Transpose 1" )
);
// Change the name of the first column
dtTrans1:Label << set name( "Column 1" ) << Set Display Width( 150 );
// Change the new column names
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i ) << set name( "Column " || Char( i + 4 ) ) << Set Display Width( 100 )
);
// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 << get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";
// Create the Devce values
deviceRow = (dtTrans1 << get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i )[deviceRow] = i - 1
);
// Now Find all of the columns that are parameters
parameterColNamesList = {};
For( i = 1, i <= N Cols( dt ), i++,
If( Is Missing( Num( Word( 1, Column( dt, i ) << get name, ":" ) ) ) == 0,
Insert Into( parameterColNamesList, Column( dt, i ) << get name )
)
);
// Transpose the parameter columns
dtTrans2 = dt << Transpose(
columns( Eval( parameterColNamesList ) ),
Transpose selected rows only( 0 ),
Output Table( "Transpose 2" )
);
// Add in the new columns to be created
dtTrans2 << Add Multiple Columns( "Column", 5, before first, Character );
// Add the values to the new columns
For( i = 1, i <= N Rows( dtTrans2 ), i++,
dtTrans2:Column 1[i] = Word( 1, dtTrans2:Label[i], ":" );
dtTrans2:Column 2[i] = Word( 2, dtTrans2:Label[i], ":" );
specs = Column( dt, dtTrans2:Label[i] ) << get property( "spec limits" );
If( Is Missing( specs["LSL"] ) == 0,
dtTrans2:Column 3[i] = specs["LSL"]
);
If( Is Missing( specs["USL"] ) == 0,
dtTrans2:Column 4[i] = specs["USL"]
);
If( Column( dt, dtTrans2:Label[i] ) << get property( "Units" ) != "",
dtTrans2:Column 5[i] = Column( dt, dtTrans2:Label[i] ) << get property( "Units" )
);
);
// Get rid of the label column which is no longer needed
dtTrans2 << delete columns( :Label );
// Change the names of the Trans2 table to match the names in the Trans1 table
For( i = 6, i <= N Cols( dtTrans2 ), i++,
Column( dtTrans2, i ) << set name( "Column " || Char( i ) )
);
// Combine the 2 Transformed data tables
dtFinal = dtTrans1 << concatenate( dtTrans2 );
// Cleanup the no longer needed data tables
close( dtTrans1, nosave );
close( dtTrans2, nosave );Re:列を行に転置するJSLスクリプトありがとうございました!これは問題なく機能するようです。 しかし、何らかの理由で、テスト名のLoLimit列とHilimits列が最後に配置されています。それらを再配置してスクリプトでラベル付けする方法はありますか?

Re:列を行に転置するJSLスクリプトどのバージョンのJMPを使用していますか?Re:列を行に転置するJSLスクリプトjmp14を使用しているim
Re:列を行に転置するJSLスクリプトこれはスクリプトの修正バージョンであり、仕様列などを正しい場所に配置し、列ラベルも追加します。
Names Default To Here( 1 );
dt = Current Data Table();
// Transpose the Demographics
dtTrans1 = dt << Transpose(
columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
Transpose selected rows only( 1 ),
Output Table( "Transpose 1" )
);
// Change the name of the first column
dtTrans1:Label << set name( "Column 1" ) << Set Display Width( 150 );
// Change the new column names
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i ) << set name( "Column " || Char( i + 4 ) ) << Set Display Width( 100 )
);
// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 << get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";
// Create the Devce values
deviceRow = (dtTrans1 << get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i )[deviceRow] = i - 1
);
// Now Find all of the columns that are parameters
parameterColNamesList = {};
For( i = 1, i <= N Cols( dt ), i++,
If( Is Missing( Num( Word( 1, Column( dt, i ) << get name, ":" ) ) ) == 0,
Insert Into( parameterColNamesList, Column( dt, i ) << get name )
)
);
// Transpose the parameter columns
dtTrans2 = dt << Transpose(
columns( Eval( parameterColNamesList ) ),
Transpose selected rows only( 0 ),
Output Table( "Transpose 2" )
);
// Add in the new columns to be created
dtTrans2 << Add Multiple Columns( "Column", 5, before first, Character );
// Add the columns 2-5 in the trans data table
dtTrans1 << Add Multiple Columns( "xColumn", 4,after(:Column 1), Character );
for(i=2,i<=5,i++,
column(dtTrans1,i)<<SET name=""></SET>Re:列を行に転置するJSLスクリプトジムありがとう!フォーマットは完璧です。ただし、何らかの理由で他の同様のデータセットでは機能しません。理由は何ですか?
Re:列を行に転置するJSLスクリプトログにエラーメッセージはありますか?
2つのデータテーブルの違いは何ですか?
スクリプトは完了する前に停止していますか?
Re:列を行に転置するJSLスクリプトログエラーはありません。スクリプトを実行しても、何も実行されません。唯一の違いはテスト名です...それらは異なります。しかし、他のすべてのヘッダーは同じですRe:列を行に転置するJSLスクリプト1行目から26行目までのコードを実行してみてください。スクリプト内のこれらの行を選択(強調表示)してから、実行アイコンをクリックするだけです。
Names Default To Here( 1 );
dt = Current Data Table();
// Transpose the Demographics
dtTrans1 = dt << Transpose(
columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
Transpose selected rows only( 1 ),
Output Table( "Transpose 1" )
);
// Change the name of the first column
dtTrans1:Label << set name( "Column 1" ) << Set Display Width( 150 );
// Change the new column names
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i ) << set name( "Column " || Char( i + 4 ) ) << Set Display Width( 100 )
);
// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 << get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";
// Create the Devce values
deviceRow = (dtTrans1 << get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i )[deviceRow] = i - 1
);
Transpose1データテーブルが次のようになっていることを確認します。

30〜35行目を実行します
parameterColNamesList = {};
For( i = 1, i <= N Cols( dt ), i++,
If( Is Missing( Num( Word( 1, Column( dt, i ) << get name, ":" ) ) ) == 0,
Insert Into( parameterColNamesList, Column( dt, i ) << get name )
)
);
そして、parameterColNamesListにデータテーブル内のすべてのテストの名前が含まれているかどうかを確認します。
次に、正しく実行されていないものが見つかるまで、コードのさまざまなセクションをチェックし続けます。
読み込もうとしているデータテーブルのコピーを提供していただければ、自分でチェックしていきます。
Re:列を行に転置するJSLスクリプト確かにここにあります
Re:列を行に転置するJSLスクリプトこれがランダムなサンプルデータです
Re:列を行に転置するJSLスクリプト前のサンプルを無視して、これを使用してください
Re:列を行に転置するJSLスクリプトこれが1つです
Re:列を行に転置するJSLスクリプト問題は、1つ以上のパラメーターが文字データとして入力されたことでした。トランスポーズは混合データを処理できません。そこで、検出されたすべてのパラメーターが数値であることを確認するためのチェックを追加しました。
Names Default To Here( 1 );
dt = Current Data Table();
// Transpose the Demographics
dtTrans1 = dt << Transpose(
columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
Transpose selected rows only( 1 ),
Output Table( "Transpose 1" )
);
// Change the name of the first column
dtTrans1:Label << set name( "Column 1" ) << Set Display Width( 150 );
// Change the new column names
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i ) << set name( "Column " || Char( i + 4 ) ) << Set Display Width( 100 )
);
// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 << get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";
// Create the Devce values
deviceRow = (dtTrans1 << get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i )[deviceRow] = i - 1
);
// Now Find all of the columns that are parameters
parameterColNamesList = {};
For( i = 1, i <= N Cols( dt ), i++,
If( Is Missing( Num( Word( 1, Column( dt, i ) << get name, ":" ) ) ) == 0,
Insert Into( parameterColNamesList, Column( dt, i ) << get name )
)
);
// Transpose the parameter columns
dtTrans2 = dt << Transpose(
columns( Eval( parameterColNamesList ) ),
Transpose selected rows only( 0 ),
Output Table( "Transpose 2" )
);
// Add in the new columns to be created
dtTrans2 << Add Multiple Columns( "Column", 5, before first, Character );
// Add the columns 2-5 in the trans data table
dtTrans1 << Add Multiple Columns( "xColumn", 4,after(:Column 1), Character );
for(i=2,i<=5,i++,
column(dtTrans1,i)<<SET name=""></SET>Re:列を行に転置するJSLスクリプトjimに感謝しますが、いくつかの理由で、更新されたスクリプトでも同じエラーが発生します

Re:列を行に転置するJSLスクリプト私のエラー....誤って、私があなたに送った最後のエントリには私の変更がありませんでした。 前回の回答を編集し、JSLを更新しました。 戻ってJSLをプルして実行してください。 修正されたコードが含まれるようになりました。