convertire colonne in righe
dati e risultati desiderati
apprezzerei molto il tuo aiuto
Ingegneria della qualità e dei processiCondivisione e comunicazione dei risultatiRi: Script JSL per trasporre colonne in righegrazie Jim
Ri: Script JSL per trasporre colonne in righeErrore mio....per errore, l'ultima voce che ti ho inviato non presentava le mie modifiche. Ho modificato la mia ultima risposta e aggiornato il JSL. Per favore torna indietro, prendi il JSL ed eseguilo. Ora contiene il codice corretto.Ri: Script JSL per trasporre colonne in righegrazie Jim ma per alcuni motivi ho ancora lo stesso errore con lo script aggiornato

Ri: Script JSL per trasporre colonne in righeIl problema era che uno o più parametri venivano immessi come dati carattere.Il Transpose non può gestire dati misti.Quindi ho aggiunto un controllo per assicurarmi che tutti i parametri rilevati siano numerici.
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 &
Column( dt, i ) << get modeling type == "Continuous",
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>Ri: Script JSL per trasporre colonne in righeeccone uno
Ri: Script JSL per trasporre colonne in righeIl messaggio di errore visualizzato indica che la tabella dati a cui punta "dtTrans2" non è stata creata."dtTrans2" viene creato da Transpose(), che richiede un elenco di parametri dalla tabella dati originale.Il "parameterColNamesList" viene creato trovando tutte le colonne nella tabella dati originale che iniziano con un numero seguito da un ":".Sospetto che i tuoi parametri non siano chiamati così nella tabella dei dati originale.Ma senza vedere la tabella dei dati, sto solo indovinando.Se quello che suppongo è vero, allora è necessario trovare qualcosa che identifichi le colonne dei parametri.
Ri: Script JSL per trasporre colonne in righeciao Jim
Trovo ancora problemi con altre tabelle dati per alcuni motivi, ho controllato il tipo di dati e mi sono assicurato che fossero tutti uguali. ma non funziona

Ri: Script JSL per trasporre colonne in righegrazie Jim
Ri: Script JSL per trasporre colonne in righeQuesta tabella di dati di esempio presenta un problema con la colonna Dispositivo.È impostato come tipo di dati carattere.Se lo cambi in Numerico, lo script funziona correttamente.
Ri: Script JSL per trasporre colonne in righeHo eseguito lo script sui dati di esempio del sottoinsieme che hai fornito, è stato eseguito senza errori e ha prodotto una tabella di dati trasposta.Ho riscontrato un piccolo problema: i nomi dei test non contenevano il nome completo dalla tabella dei dati di input.Ma a parte questo, sembra che abbia funzionato correttamente.

Ecco il JSL corretto
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>Ri: Script JSL per trasporre colonne in righeignorare l'esempio precedente, utilizzare questo
Ri: Script JSL per trasporre colonne in righeecco un campione di dati casuale
Ri: Script JSL per trasporre colonne in righeok certo eccolo qui
Ri: Script JSL per trasporre colonne in righeProva a eseguire il codice dalla riga 1 alla riga 26. Tutto quello che devi fare è selezionare (evidenziare) quelle righe nello script, quindi fare clic sull'icona Esegui.
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
);
Verifica se la tabella dati Transpose 1 è simile a:

Esegui le righe 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 )
)
);
e vedere se il parametroColNamesList contiene i nomi di tutti i test nella tabella dati.
Quindi continua a controllare le diverse sezioni del codice, finché non trovi ciò che non funziona correttamente.
Se puoi fornirmi una copia della tabella dati che stai tentando di leggere, sarei disposto a eseguire io stesso il controllo.
Ri: Script JSL per trasporre colonne in righenon c'è nessun errore di registro. quando eseguo lo script, semplicemente non fa nulla. l'unica differenza sono i nomi dei test... sono diversi. ma tutte le altre intestazioni sono le stesseRi: Script JSL per trasporre colonne in righeCi sono messaggi di errore nel registro?
Quali sono le differenze tra le 2 tabelle dati?
Lo script si interrompe prima del completamento?
Ri: Script JSL per trasporre colonne in righegrazie Jim! il formato è perfetto. tuttavia, per qualche motivo, non funziona con altri set di dati simili. qualche motivo?
Ri: Script JSL per trasporre colonne in righeEcco una versione corretta dello script, che posiziona le colonne delle specifiche, ecc. nella posizione corretta e aggiunge anche le etichette delle colonne
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>Ri: Script JSL per trasporre colonne in righesto usando jmp 14
Ri: Script JSL per trasporre colonne in righeQuale versione di JMP stai utilizzando?Ri: Script JSL per trasporre colonne in righeGrazie! questo sembra funzionare bene. Ma per qualche motivo le colonne del nome del test Limite Lo e Limiti Hi vengono inserite per ultime. in qualche modo possiamo riorganizzarli ed etichettarli nello script?
Ri: Script JSL per trasporre colonne in righeLo script seguente è un buon inizio per creare la tabella di output richiesta
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 );