Riempi le celle vuote in base alla valutazione del valore di una colonna diversa nelle righe sopraCIAO
Ho il seguente problema:
Voglio riempire le celle tramite una formula o uno script nella colonna "Elenco principale" in absed al successivo valore n-1 nella colonna Livello:
Compila la cella vuota (colonna "Elenco principale", riga 10):
•Nella riga con la cella vuota vai alla colonna Livello contenente il valore "4"
•Calcola n-1 (“3”)
•Trova la riga successiva sopra che contiene il valore n-1 (3), ovvero la riga n. 9. Copia il carattere (7P61G05) della colonna Materiale nella cella vuota (Elenco parti, riga 10):

Riempi tutte le celle vuote di conseguenza.
Inoltre potrebbe verificarsi il seguente caso speciale:
La numerazione diminuisce: seleziona ancora la riga con il valore n-1 nella cella

spero che qualcuno possa risolverlo! Grazie in anticipo,
Mattia
Modellazione statistica avanzataAutomazione e scriptingCombinazione e pulizia dei datiRi: Riempi le celle vuote in base alla valutazione del valore di una colonna diversa nelle righe sopraDi seguito è riportata un'altra idea in quanto utilizza un metodo leggermente diverso da quello di Jed
Names Default To Here(1);
// format data
dt = Open("$DOWNLOADS\Fill empty cells V2.jmp");
Column(dt, "Desired Column")[10::N Rows(dt)] = ""; // set empty values
Column(dt, "Desired Column") << Set Name("Parent List");
//Column(dt, "Parent List") << Set Each Value( I would suggest creation of new column
dt << New Column("ParentListFixed", Character, Nominal, << Set Each Value(
As Constant(
m_levels = :Level << get values;
m_materials = :Material << get values;
);
If(Is Missing(:"Parent List"n) & !Is Missing(:Level),
level_to_search = :Level - 1;
If(level_to_search > 0,
row_of_interest = Max(Loc(m_levels[1::Row()], level_to_search));
m_materials[row_of_interest];
,
"";
);
,
:"Parent List"n
);
));Ri: Riempi le celle vuote in base alla valutazione del valore di una colonna diversa nelle righe sopraCaro Jed
Fantastico, lo script funziona perfettamente, come previsto! Grazie mille per il supporto. Questo sarà parte integrante di uno script che fornirà i dati SAP in un formato che li rende accessibili per il monitoraggio dei materiali, il che è un problema in SAP. Il mio script precedente ha già reso JMP piuttosto popolare all'interno dell'azienda poiché è ampiamente utilizzato. Grazie anche per il corso di scripting. Questo è sicuramente qualcosa che mi piacerebbe imparare meglio.
Quindi grazie ancora e cordiali saluti,
Mattia
Ri: Riempi le celle vuote in base alla valutazione del valore di una colonna diversa nelle righe sopraAh, ora capisco meglio, credo, cosa stai cercando. Ecco uno script aggiornato, nonché un file collegamento al corso online gratuito ed eccellente sullo scripting JMP
/*JMP STATISTICAL DISCOVERY LLC (“JMP”) PERMITS THE USE OF THIS COMPUTER SOFTWARE CODE (“CODE”) ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO THE TERMS LISTED HEREIN. BY USING THE CODE, YOU AGREE TO THESE TERMS. YOUR USE OF THE CODE IS AT YOUR OWN RISK. JMP MAKES NO REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRIGEMENT, AND TITLE, WITH RESPECT TO THE CODE.
You may use the Code solely as part of a software product you currently have licensed from JMP, JMP’s parent company SAS Institute Inc. (“SAS”), or one of JMP’s or SAS’s subsidiaries or authorized agents (the “Software”), and not for any other purpose. The Code is designed to add functionality to the Software but has not necessarily been tested. Accordingly, JMP makes no representation or warranty that the Code will operate error-free. JMP is under no obligation to maintain, support, or continue to distribute the Code.
Neither JMP nor its licensors shall be liable to you or any third-party for any general, special, direct, indirect, consequential, incidental, or other damages whatsoever arising out of or related to your use or inability to use the Code, even if JMP has been advised of the possibility of such damages. Except as otherwise provided above, the Code is governed by the same agreement that governs the Software. If you do not have an existing agreement with JMP or SAS governing the Software, you may not use the Code.
JMP and all other JMP Statistical Discovery LLC product or service names are registered trademarks or trademarks of JMP Statistical Discovery LLC in the USA and other countries. ® indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies.
*/
Names Default To Here( 1 );
dt = Current Data Table();
row()=10;
For Each Row(
dt,
If( Row() > 1,
n = row(); //temporary row variable for later
look_for_n = :Level[Row()] - 1; //find Level - 1
rows_with_n = dt << get rows where( :Level == look_for_n & row() < n ); //get all rows that match
last_n = rows_with_n[N Items( rows_with_n )]; //get the last of those rows
:Desired Column = Char( :Material[last_n] ); //put into desired column
)
);
Ri: Riempi le celle vuote in base alla valutazione del valore di una colonna diversa nelle righe sopraCiao Jed,
È fantastico! Grazie mille per il grande supporto! C'è ancora un piccolo dollaro, forse puoi risolvere anche quello?
Lo script sembra cercare il numero n-1 più in basso nella Colonna Livello mentre dovrebbe cercare l'ultimo n-1, in questo caso il Livello “3”, cioè prima della cella da riempire! Quindi sono stati utilizzati i caratteri sbagliati nelle celle delle righe da 10 a 14. Ho creato la colonna "Corretto" dove puoi vedere la cella riempita correttamente:

Lo script utilizza i caratteri "D9844" del prossimo Livello 3 invece di "7P61G05" dell'ultimo Livello 3 prima della rispettiva riga.
Aggiungerò la tabella jmp.
Grazie in anticipo e cordiali saluti,
Mattia
Ri: Riempi le celle vuote in base alla valutazione del valore di una colonna diversa nelle righe sopraSe ho capito bene, questo JSL dovrebbe fare quello che stai cercando:
/*JMP STATISTICAL DISCOVERY LLC (“JMP”) PERMITS THE USE OF THIS COMPUTER SOFTWARE CODE (“CODE”) ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO THE TERMS LISTED HEREIN. BY USING THE CODE, YOU AGREE TO THESE TERMS. YOUR USE OF THE CODE IS AT YOUR OWN RISK. JMP MAKES NO REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRIGEMENT, AND TITLE, WITH RESPECT TO THE CODE.
You may use the Code solely as part of a software product you currently have licensed from JMP, JMP’s parent company SAS Institute Inc. (“SAS”), or one of JMP’s or SAS’s subsidiaries or authorized agents (the “Software”), and not for any other purpose. The Code is designed to add functionality to the Software but has not necessarily been tested. Accordingly, JMP makes no representation or warranty that the Code will operate error-free. JMP is under no obligation to maintain, support, or continue to distribute the Code.
Neither JMP nor its licensors shall be liable to you or any third-party for any general, special, direct, indirect, consequential, incidental, or other damages whatsoever arising out of or related to your use or inability to use the Code, even if JMP has been advised of the possibility of such damages. Except as otherwise provided above, the Code is governed by the same agreement that governs the Software. If you do not have an existing agreement with JMP or SAS governing the Software, you may not use the Code.
JMP and all other JMP Statistical Discovery LLC product or service names are registered trademarks or trademarks of JMP Statistical Discovery LLC in the USA and other countries. ® indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies.
*/
Names Default To Here( 1 );
dt = Current Data Table();
For Each Row(
dt,
If( Row() > 1,
look_for_n = :Level[Row()] - 1; //find Level - 1
rows_with_n = dt << get rows where( :Level == look_for_n ); //get all rows that match
last_n = rows_with_n[N Items( rows_with_n )]; //get the last of those rows
:Desired Column = Char( :Material[last_n] ); //put into desired column
)
);
Ri: Riempi le celle vuote in base alla valutazione del valore di una colonna diversa nelle righe sopraSì, certo, grazie. Nella colonna "Colonna desiderata" ho copiato le celle dalla colonna "Materiale" che mi aspetto che lo script inserisca, a seconda dei valori nella colonna "Livello!
Ri: Riempi le celle vuote in base alla valutazione del valore di una colonna diversa nelle righe sopraPotresti fornire una tabella dati con i dati e una colonna che contiene i valori corretti?