我有不同產品 (AH) 的生產運作及其開始和結束時間的索引清單。有時,同一產品有連續兩行(第 1 行和第 2 行以及第 7 行和第 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");