我有一份不同产品 (AH) 生产运行及其开始和结束时间的索引列表。有时同一行中有两行产品 (第 1 行和第 2 行以及第 7 行和8) 我希望将它们合并为一行,第一行显示开始时间,第二行显示结束时间。如何使用 JSL 来实现这一点?

我认为这应该能满足你的要求。
在表中添加新的(数字)列,使用如下公式计算“组”
If(Row() == 1,
counter = 0;
);
If(:Product != Lag(:Product),
counter++;
);
counter;
Then you can use Summary table to perform the min/max part</CODE></P>
<P><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1713458056939.png" style="width: 999px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="jthi_1-1713458056939.png" style="width: 999px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="jthi_1-1713458056939.png" style="width: 999px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="jthi_1-1713458056939.png" style="width: 999px;"><span class="lia-inline-image-display-wrapper" image-alt="jthi_1-1713458056939.png" style="width: 999px;"><img src="https://us.v-cdn.net/6038925/uploads/images/63473i931158173607E606/jthi_1-1713458056939.png" role="button" title="jthi_1-1713458056939.png" alt="jthi_1-1713458056939.png" /></span></SPAN></SPAN></SPAN></SPAN></P>
<P>根据需要从汇总表中删除并重新排序列</P>
<P> </P>
<P>以下是增强日志中执行这些操作的脚本</P>
<P> </P>
<PRE><CODE class=" language-jsl">// Open Data Table: Run Time Index.jmp
// → Data Table("Run Time Index")
Open("$DOWNLOADS/Run Time Index.jmp");
// New column: R
Data Table("Run Time Index") << New Column("R",
Numeric,
"Continuous",
Format("Best", 12),
Formula(
If(Row() == 1, counter = 0);
If(:Product != Lag(:Product),
counter
++);
counter;
)
);
// Data table summary
// → Data Table("Run Time Index By (R, Product)")
Data Table("Run Time Index") << Summary(
Group(:R, :Product),
Min(:Run Index),
Min(:Start),
Max(:End),
Freq("None"),
Weight("None"),
statistics column name format("column"),
Link to original data table(0)
);
// Delete columns
Data Table("Run Time Index By (R, Product)") << Delete Columns(:R, :N Rows);
// Move selected column: Run Index
Data Table("Run Time Index By (R, Product)") << Move Selected Columns({:Run Index}, To First);
// Change column modeling type: Run Index
Data Table("Run Time Index By (R, Product)"):Run Index << Set Modeling Type("Ordinal");