CIAO!
Attualmente sto lavorando a un progetto utilizzando JMP/JSL e, sui miei dati, devo eliminare o cancellare valori da più celle in base a una condizione. Vedi i dati grezzi di esempio e l'output richiesto di seguito.
Dati grezzi:
| Prova1 | P/F 1 | Prova2 | P/F 2 | Prova3 | P/F 3 | Prova4 | P/F 4 | Prova5 | P/F 5 |
| 1 | P | 2 | P | 4 | P | 9 | F | 3 | P |
| 5 | P | 8 | F | 4 | P | 6 | F | 2 | P |
| 7 | P | 1 | P | 6 | F | 5 | F | 6 | F |
| 4 | P | 1 | P | 9 | F | 9 | F | 9 | F |
| 6 | F | 4 | P | 10 | F | 10 | F | 8 | F |
Uscita richiesta:
| Prova1 | P/F 1 | Prova2 | P/F 2 | Prova3 | P/F 3 | Prova4 | P/F 4 | Prova5 | P/F 5 |
| 1 | P | 2 | P | 4 | P | 9 | F | * | * |
| 5 | P | 8 | F | * | * | * | * | * | * |
| 7 | P | 1 | P | 6 | F | * | * | * | * |
| 4 | P | 1 | P | 9 | F | * | * | * | * |
| 6 | F | * | * | * | * | * | * | * | * |
Ciò che è necessario qui è cancellare tutte le celle successive una volta attivato il primo F (fallimento).
Sto lavorando su dati di grandi dimensioni e credo che ciò possa essere fatto solo tramite script.
Ho provato le funzioni di loop ma nessuna finora funziona. Non sono davvero sicuro che ciò sia possibile anche su JSL.
Grazie in anticipo per il vostro aiuto!
Questo ha davvero risolto il problema!!! Complimenti!
Sono stato anche sorpreso che abbia funzionato meno di un secondo per migliaia di celle.
Grazie!!
Vedi se questo funziona per te.
Names default to here(1);
dt = New Table( "Example",
Add Rows( 5 ),
New Column( "Test1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected,
Set Values( [1, 5, 7, 4, 6] )
),
New Column( "P/F 1",
Character( 16 ),
"Nominal",
Set Values( {"P", "P", "P", "P", "F"} )
),
New Column( "Test2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [2, 8, 1, 1, 4] )
),
New Column( "P/F 2",
Character( 16 ),
"Nominal",
Set Values( {"P", "F", "P", "P", "P"} )
),
New Column( "Test3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [4, 4, 6, 9, 10] )
),
New Column( "P/F 3",
Character( 16 ),
"Nominal",
Set Values( {"P", "P", "F", "F", "F"} )
),
New Column( "Test4",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [9, 6, 5, 9, 10] )
),
New Column( "P/F 4",
Character( 16 ),
"Nominal",
Set Values( {"F", "F", "F", "F", "F"} )
),
New Column( "Test5",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [3, 2, 6, 9, 8] )
),
New Column( "P/F 5",
Character( 16 ),
"Nominal",
Set Values( {"P", "P", "F", "F", "F"} )
)
);
bad_rows = [];
for(i=1, i<=ncols(dt), i++,
col = Column(dt, i);
if(col << Get Data Type == "Character", //this is an assumption that your P/F cols are the only char
if(nrows(bad_rows), //check if there's anything to clear
col[bad_rows] = ""; // clear character
);
bad_rows |/= loc(col <<GET values=""></GET>