Ich versuche, eine Zusammenfassung verschiedener Testnummern mit demselben Testnamen von Tabelle 1 bis Tabelle 2 zu erstellen. Gibt es einen schnellen und schmutzigen Weg in JMP, um dies zu erreichen? Vielen Dank
Tabelle 1
| Testnum | Testname |
| T17561 | Ana_Limiter_vdhf_ATE_Chara_LA @ LA-LB |
| T17562 | Ana_Limiter_vdhf_ATE_Chara_LA @ LA-LB |
| T17563 | Ana_Limiter_vdhf_ATE_Chara_LA @ LA-LB |
| T17564 | Ana_Limiter_vdhf_ATE_Chara_LA @ LA-LB |
| T17565 | Ana_Limiter_vdhf_ATE_Chara_LA @ LA-LB |
| T17566 | Ana_Limiter_vdhf_ATE_Chara_LA @ LA-LB |
| T17567 | Ana_Limiter_vdhf_ATE_Chara_LA @ LA-LB |
| T17621 | Ana_PowerRegulator_ATE_Chara @ LA |
| T17622 | Ana_PowerRegulator_ATE_Chara @ LA |
| T17623 | Ana_PowerRegulator_ATE_Chara @ LA |
| T17624 | Ana_PowerRegulator_ATE_Chara @ LA |
Tabelle 2
| Testname | Testnum |
| Ana_Limiter_vdhf_ATE_Chara_LA @ LA-LB | T17561, T17562, T17563, T17564, T17565, T17566, T17567 |
| Ana_PowerRegulator_ATE_Chara @ LA | T17621, T17622, T17623, T17624 |
Ich bin mir nicht ganz sicher, wonach Sie fragen. Wenn Sie jedoch Ihre Tabelle 2 aus der Tabelle 1 erstellen möchten, finden Sie hier ein Skript, das dies erledigt
names default to here(1);
// Create the sample table
dt = New Table( "Example",
Add Rows( 11 ),
New Script(
"Source",
Data Table( "Untitled 13" ) << Split(
Split By( :Column 2 ),
Split( :Column 1 ),
Sort by Column Property
)
),
New Column( "testnum",
Character,
"Nominal",
Set Selected,
Set Values(
{"T17561", "T17562", "T17563", "T17564", "T17565", "T17566", "T17567",
"T17621", "T17622", "T17623", "T17624"}
),
Set Display Width( 68 )
),
New Column( "testname",
Character,
"Nominal",
Set Values(
{"Ana_Limiter_vdhf_ATE_Chara_LA@LA-LB",
"Ana_Limiter_vdhf_ATE_Chara_LA@LA-LB",
"Ana_Limiter_vdhf_ATE_Chara_LA@LA-LB",
"Ana_Limiter_vdhf_ATE_Chara_LA@LA-LB",
"Ana_Limiter_vdhf_ATE_Chara_LA@LA-LB",
"Ana_Limiter_vdhf_ATE_Chara_LA@LA-LB",
"Ana_Limiter_vdhf_ATE_Chara_LA@LA-LB", "Ana_PowerRegulator_ATE_Chara@LA",
"Ana_PowerRegulator_ATE_Chara@LA", "Ana_PowerRegulator_ATE_Chara@LA",
"Ana_PowerRegulator_ATE_Chara@LA"}
),
Set Display Width( 244 )
)
); // End of Example table creation
// Create the new summary data table
dtTrans = dt << Transpose(
columns( :testnum ),
By( :testname ),
Output Table( "Transpose" )
);
// Get rid of the not needed column called "Label"
dtTrans << delete columns("Label");
// Get a list of the columns in the data table
colNames = dtTrans << get column names(string);
// Get rid of the first column so the list only contains the transposed columns
colNames = remove(colNames,1,1);
// Create the new testnum column
dtTrans << New Column( "testnum", character );
// Loop through all of the rows in the table and create the concatenated column
For( theRow = 1, theRow <= N Rows( dtTrans ), theRow++,
:testnum[theRow] = :Row 1[theRow];
For( theCol = 2, theCol <= N Items( colNames ), theCol++,
If( Column( colNames[theCol] )[theRow] != "",
:testnum[theRow] = :testnum[theRow] || ", " || Char( Column( colNames[theCol] )[theRow] )
)
);
);
// Delete the unnecessary columns
dtTrans << delete columns( colNames );
Wenn das, was Sie wollen, etwas anderes ist, geben Sie bitte genau das an, was Sie wollen
Die von mir bereitgestellte JSL funktioniert für eine beliebige Anzahl von Testnamen und Testnummern
Names Default To Here( 1 );
dt = New Table( "Example", New Column( "testname", character ), New Column( "testnum", character ) );
For( i = 1, i <= 50, i++,
tnam = "Testname" || Char( i );
kstart = Random integer( 1, 5 );
For( k = kstart, k <= Random integer( 1, 25 + kstart ), k++,
dt << add rows( 1 );
dt:testname[N Rows( dt )] = tnam;
dt:testnum[N Rows( dt )] = "T" || Char( k );
);
);
// Create the new summary data table
dtTrans = dt << Transpose(
columns( :testnum ),
By( :testname ),
Output Table( "Transpose" )
);
// Get rid of the not needed column called "Label"
dtTrans << delete columns("Label");
// Get a list of the columns in the data table
colNames = dtTrans << get column names(string);
// Get rid of the first column so the list only contains the transposed columns
colNames = remove(colNames,1,1);
// Create the new testnum column
dtTrans << New Column( "testnum", character );
// Loop through all of the rows in the table and create the concatenated column
For( theRow = 1, theRow <= N Rows( dtTrans ), theRow++,
:testnum[theRow] = :Row 1[theRow];
For( theCol = 2, theCol <= N Items( colNames ), theCol++,
If( Column( colNames[theCol] )[theRow] != "",
:testnum[theRow] = :testnum[theRow] || ", " || Char( Column( colNames[theCol] )[theRow] )
)
);
);
// Delete the unnecessary columns
dtTrans << delete columns( colNames );
