按降序对列进行排序并使用 4 个最大的进行计算我有一个数据表,需要从标记为“Nozzle #”的一系列列中获取前 4 个最大值。 这些列值因变量或标记为“测试#”的列而异。

然后,我需要应用这些值,并在新列中计算每个测试的圆面积。 由于我有一个更大的数据表,我想使用 For、If 和 Contains 逻辑对列进行分组,或者 JSL 中是否有更有效的方法?
回复:按降序对列进行排序并使用 4 个最大的进行计算请看一下我给你的第一个公式。它首先创建给定行的不同列的所有值的列表。然后对值进行排序,最后将前四个值放入字符串中。
如果您将该代码添加到最新代码中,则会生成包含前 4 个最大值的列的值。
回复:按降序对列进行排序并使用 4 个最大的进行计算尝试了一下,代码如下所示,但它给了我所有已排序的值。
theList = {};
For( i = 2, i <= 7, i++,
For Each Row(
Eval( Parse( "Insert Into( theList," || Char( Column( dt, i )[Row()] ) || ")" ) )
)
);
theList = Sort Descending( theList );屈服,
<SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 814px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="image.png" style="width: 814px;"><span class="lia-inline-image-display-wrapper" image-alt="image.png" style="width: 814px;"><img src="https://us.v-cdn.net/6038925/uploads/images/21024iC715F1791A69F0B3/image.png" role="button" title="image.png" alt="image.png" /></span></SPAN></SPAN>
回复:按降序对列进行排序并使用 4 个最大的进行计算尝试使用此表格
dt = Current Data Table();
theList = {};
For( i = 2, i <= 7, i++,
Eval( Parse( "Insert Into( theList," || Char( Column( dt, i )[Row()] ) || ")" ) )
);
theList = Sort Descending( theList );回复:按降序对列进行排序并使用 4 个最大的进行计算所以我尝试使用 for 循环将列放入列表中,如下所示列表第一在喷嘴_script.jsl 文件中。 每当我尝试对它们进行排序时,仅对列名称进行排序,而不对列值进行排序。 我还尝试使用您显示的代码,并且列表在日志中显示为空,如下所示。

我的总体目标是这样的:

(注意:我手动输入了“最大”列值。 然后对“面积”列应用(“最大”/4)^2 公式。)
我在下面附上了数据表和我的脚本。 谢谢你!
回复:按降序对列进行排序并使用 4 个最大的进行计算以下是执行此操作的一种方法的示例。我承认这有点疯狂,但它应该向您展示一些 JCL,让您了解自己可以做什么。我已经在您第一次查询中显示的数据表的新列中完成了计算。

这是我为新列开发的公式
theList = {};
Insert Into( theList, :Nozzle 1 );
Insert Into( theList, :Nozzle 2 );
Insert Into( theList, :Nozzle 3 );
Insert Into( theList, :Nozzle 4 );
Insert Into( theList, :Nozzle 5 );
Insert Into( theList, :Nozzle 6 );
theList = Sort Descending( theList );
theOutput = Char( theList[1] );
theOutput = theOutput || ", " || Char( theList[2] );
theOutput = theOutput || ", " || Char( theList[3] );
theOutput = theOutput || ", " || Char( theList[4] );
theOutput;回复:按降序对列进行排序并使用 4 个最大的进行计算我想要每次测试的前 4 个最大喷嘴值。 所以,它会是:
18684 = 5.5 5 4 0
18685 = 5 5 4 0.5
18688 = 5.5 5 4 0.5
18689 = 5 5 0.5 0
回复:按降序对列进行排序并使用 4 个最大的进行计算您想要每行的喷嘴 # 列的前 4 个最大值,还是所有喷嘴 # 列的所有行的前 4 个最大值?