根据上面行中不同列的值的评估填充空单元格你好
我有以下问题:
我想通过“父列表”列中的公式或脚本填充单元格,该列位于“级别”列中的下一个 n-1 值上:
填充空单元格(“父列表”列,第 10 行):
•在带有空单元格的行中转到包含值“4”的级别列
•计算n-1(“3”)
• 查找上面包含值 n-1 (3) 的下一行,即第 9 行。 将材料列的字符 (7P61G05) 复制到空单元格(零件列表,第 10 行):

相应地填充所有空单元格。
另外还可能出现以下特殊情况:
编号下降:仍然选择单元格中具有 n-1 值的行

我希望任何人都可以解决这个问题! 预先感谢您,
马蒂亚斯
高级统计建模自动化和脚本编写数据混合和清理回复:根据上面行中不同列的值评估填充空单元格下面是另一个想法,因为它使用的方法与 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
);
));回复:根据上面行中不同列的值评估填充空单元格亲爱的杰德
太棒了,脚本完美运行,符合预期! 非常感谢您的支持。 这将是脚本的组成部分,该脚本将以某种形式提供 SAP 数据,使数据可用于物料跟踪,这在 SAP 中是一个难题。 我之前的脚本已经使JMP在公司内非常受欢迎,因为它被广泛使用。 也感谢您的脚本课程。 这绝对是我想更好地学习的东西。
再次感谢并致以最诚挚的问候,
马蒂亚斯
回复:根据上面行中不同列的值评估填充空单元格啊,现在我更好地理解了,我想,你在寻找什么。 这是一个更新的脚本,以及链接到免费且优秀的在线 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
)
);
回复:根据上面行中不同列的值评估填充空单元格你好杰德,
这是太棒了! 非常感谢您的大力支持! 还有一点小钱,也许你也能解决这个问题?
该脚本似乎在级别列中进一步向下查找 n-1 数字,而它应该查找最后一个 n-1,在本例中为级别“3”,即在要填充的单元格之前! 因此,第 10 行到第 14 行的单元格中使用了错误的字符。我创建了“正确”列,您可以看到正确填充的单元格:

该脚本使用下一个即将到来的第 3 级中的字符“D9844”,而不是相应行之前最后一个第 3 级中的“7P61G05”。
我将添加 jmp 表。
预先感谢您并致以最诚挚的问候,
马蒂亚斯
回复:根据上面行中不同列的值评估填充空单元格如果我理解正确,这个 JSL 应该可以满足您的要求:
/*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
)
);
回复:根据上面行中不同列的值评估填充空单元格是的,当然,谢谢。 在“所需列”列中,我复制了“材料”列中的单元格,我希望脚本应插入这些单元格,具体取决于“级别!”列中的值。
回复:根据上面行中不同列的值评估填充空单元格您能否提供包含数据和包含正确值的一列的数据表?