Llene las celdas vacías según la evaluación del valor de la columna diferente en las filas anterioresHola
Tengo el siguiente problema:
Quiero llenar celdas mediante una fórmula o secuencia de comandos en la columna "Lista principal" sin el siguiente valor n-1 en la columna Nivel:
Llene la celda vacía (columna "Lista de padres", fila 10):
•En la fila con la celda vacía, vaya a la columna Nivel que contiene el valor "4"
•Calcular n-1 (“3”)
•Busque la siguiente fila de arriba que contenga el valor n-1 (3), que es la fila número 9. Copie el carácter (7P61G05) de la columna Material en una celda vacía (Lista de piezas, fila 10):

Llene todas las celdas vacías en consecuencia.
Además puede ocurrir el siguiente caso especial:
La numeración disminuye: aún seleccione la fila con valor n-1 en la celda

Espero que alguien pueda resolver eso! Gracias de antemano,
Matías
Modelado estadístico avanzadoAutomatización y secuencias de comandosCombinación y limpieza de datosRe: Rellenar celdas vacías basándose en la evaluación del valor de diferentes columnas en las filas anterioresA continuación se muestra otra idea, ya que utiliza un método un poco diferente al de 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
);
));Re: Rellenar celdas vacías basándose en la evaluación del valor de diferentes columnas en las filas anterioresQuerido Jed
¡Genial, el guión funciona perfectamente, según lo previsto! Muchas gracias por el apoyo. Esto será parte integral de un script que proporcionará datos de SAP en una forma que los haga accesibles para el seguimiento de materiales, lo cual es una molestia en SAP. Mi script anterior ya hizo que JMP fuera bastante popular dentro de la empresa, ya que se utiliza ampliamente. Gracias también por el curso de scripting. Definitivamente eso es algo que me gustaría aprender mejor.
Así que gracias de nuevo y un saludo cordial.
Matías
Re: Rellenar celdas vacías basándose en la evaluación del valor de diferentes columnas en las filas anterioresAh, creo que ahora entiendo mejor lo que estás buscando. Aquí hay un script actualizado, así como un enlace al excelente y gratuito curso en línea JMP Scripting
/*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
)
);
Re: Rellenar celdas vacías basándose en la evaluación del valor de diferentes columnas en las filas anterioresHola Jed,
¡Esto es fantástico! ¡Muchas gracias por el gran apoyo! Aún queda una pequeña cantidad de dinero, ¿quizás puedas resolverlo también?
El script parece buscar el número n-1 más abajo en la columna de nivel, mientras que debería buscar el último n-1, en este caso el nivel "3", que está antes de la celda que se va a llenar. Entonces tomó los caracteres incorrectos en las celdas de las filas 10 a 14. Creé la columna "Correcto" donde puedes ver la celda completa correcta:

El script utiliza los caracteres "D9844" del próximo nivel 3 en lugar de "7P61G05" del último nivel 3 antes de la fila respectiva.
Agregaré la tabla jmp.
Gracias de antemano y saludos cordiales,
Matías
Re: Rellenar celdas vacías basándose en la evaluación del valor de diferentes columnas en las filas anterioresSi entiendo correctamente, este JSL debería hacer lo que estás buscando:
/*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
)
);
Re: Rellenar celdas vacías basándose en la evaluación del valor de diferentes columnas en las filas anterioresSí, por supuesto, muchas gracias. En la columna "Columna deseada", copié las celdas de la columna "Material" que esperaría que insertara el script, dependiendo de los valores de la columna "¡Nivel!
Re: Rellenar celdas vacías basándose en la evaluación del valor de diferentes columnas en las filas anteriores¿Podría proporcionar una tabla de datos con los datos y una columna que contenga los valores correctos?