<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Vorrei creare un array associativo dai valori delle colonne.Sono curioso di sapere se qualcuno nella comunità JMP ha una soluzione intelligente.Sto usando JMP10. Un esempio è sotto.
// Per la seguente tabella di dati:
esempio = Nuova tabella( "Dati di esempio", Aggiungi righe( 27 ), Nuova colonna( "Lotto", Carattere, Nominale, Imposta valori(
{"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "B", "B", "B", " Si, "Si", "Si", "Si", "Si", "Si", "Do", "Do", "Do", "Do", "Do", "Do", "Do" , "C", "C"}
) ), Nuova colonna( "Test", Carattere, Nominale, Imposta valori(
{"Test1", "Test1", "Test1", "Test2", "Test2", "Test2", "Test3", "Test3", "Test3", "Test1", "Test1", "Test1", " Test2", "Test2", "Test2",
"Test3", "Test3", "Test3", "Test1", "Test1", "Test1", "Test2", "Test2", "Test2", "Test3", "Test3", "Test3"}
) ), Nuova colonna( "Parametro", Carattere, Nominale, Imposta valori(
{"Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", " Param1",
"Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2", "Param3", "Param1", "Param2 ",
"Param3"} ) ), Nuova colonna( "Resa", Numerico, Continuo, Formato( "", 16 ),
Imposta valori( [1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0] )
), Nuova colonna( "Codice difetto", Carattere, Nominale, Formula( If( :Resa == 0, :Test || "_" || :Parametro ) ) ) );
// Vorrei creare un array associativo con chiave = Lotto e valori = Codici difetto.Si prega di vedere l'esempio qui sotto.
// Qual è il modo migliore per scriverlo?
// Come bonus, è possibile creare un array associativo con più livelli (IE: Lot => Test => Parameter => Defect Code)?
Difetti = Array associativo( esempio:Lot );
Difetti["A"] = {"Test1_Param3", "Test2_Param2", "Test2_Param3", "Test3_Param2"};
Difetti["B"] = {"Test1_Param1", "Test1_Param2", "Test1_Param3", "Test2_Param2", "Test3_Param2", "Test3_Param3"};
Difetti["C"] = {"Test1_Param2", "Test1_Param3", "Test2_Param3", "Test3_Param3"};
// Grazie per l'aiuto!
Se qualcuno è curioso:
Difetti = Array associativo( :Lot );
currentkey1 = Difetti << Primo;
For( i = 1, i <= N Items( Difetti ), i++,
values1 = Associative Array( :Test[example << Get Rows Where( :Lot == currentkey1 )] );
Difetti[currentkey1] = valori1;
currentkey2 = Difetti[currentkey1] << Primo;
For( j = 1, j <= N Items( Defects[currentkey1] ), j++,
values2 = :Codice difetto[esempio << Ottieni righe Where( :Lot == currentkey1 & :Test == currentkey2 & :Yield == 0 )];
Difetti[currentkey1][currentkey2] = valori2;
nextkey2 = Difetti[currentkey1] << Next( currentkey2 );
currentkey2 = nextkey2;
);
nextkey1 = Difetti << Next( currentkey1 );
currentkey1 = nextkey1;
);
Mostra( Difetti );
Ho capito come creare un array associativo con chiave = Lotto e valori = Codici difetto .
Sono curioso di sapere se ci sono consigli sugli array associativi con più livelli.Grazie!
Difetti = Array associativo( esempio:Lot );
currentkey = Difetti << Primo;
For( i = 1, i <= N Elementi( Difetti ), i++,
valori = :Codice difetto[esempio << Ottieni righe Where( :Lot == currentkey & :Yield == 0 )];
Difetti[currentkey] = valori;
nextkey = Difetti << Next( currentkey );
tastocorrente = tastosuccessivo;
);
Mostra( Difetti );