我如何根据几列中的值反转取消隐藏和取消排除行你好,
我在这里需要一些指导....
我有两列 (per_Change) 和 Step(这是一个基于公式的值),Per_Change 列从 -ve 到 +ve 值排序。
在我的脚本中,我需要知道最大行数,所以我创建了 1-14 的排名列(如附图所示升序)并且需要至少 8 行(从最高排名开始)。
脚步:
1. 在 Per_Change 列中排除 -ve 值
2. 然后在 Col Step 中基于一些公式,它会创建一些“-ve”和“+ve”以及一些“null”值。 隐藏并排除 col Step 中的所有 -ve 值。空值已根据 Col Per_Change 隐藏和排除,因为公式将生成 -ve 值。
3. 我的要求是至少有 8 个值(降序)。 在我的示例中,有 6 个清晰的行状态(排名 9-14)(另外 2 行应该从降序排列,即取消隐藏/取消排除排名 8 和 7,但如果空值更多且更少,则不应在场景中包含“空”值-ve 或 +ve 列步骤中的值)。
第 1 步和第 2 步,我能够在 JSL 脚本中执行,但在启用 2 个附加行时遇到问题。
我尝试使用滞后函数并创建虚拟列以按相反顺序启用,但我很难取消选择其他行。
.
谢谢你!
回复:我如何根据几列中的值反转取消隐藏和取消排除行感谢您的及时回复...有效!
回复:我如何根据几列中的值反转取消隐藏和取消排除行CG,我附上了一个名为PerChangeExample的数据表来模拟你的例子。
试试这个脚本
Names Default to Here(1);
dt = Data Table("PerChangeExample");
dt << select where(:Per_change < 0 | IsMissing(:Per_change) );
dt << exclude(1) << hide(1);
dt << select where(:Step < 0 | IsMissing(:Step) );
dt << exclude(1) << hide(1);
dt << clear select;
nexcl = nrow( dt << get excluded rows() );
if ( nrow(dt) - nexcl < 8,
for(i = nexcl, i > nrow(dt) -8 , i--,
if ( !IsMissing(:Step[i]),
dt << Select Rows(i);
dt << Exclude(0) << Hide(0);
dt << clear select;
)
); //end for i
); // end if
nexcl = nrow( dt << get excluded rows() );
if ( nrow(dt) - nexcl < 8, throw() ); //stop program execution if still not enough data.