这与分区脚本有关,我试图在分区功能后将选定和未选定的行保存为不同的表。 但是当我这样做时,整个 JSL 脚本就会进入一个无限循环。 有没有办法解决这个问题?
我猜它会进入无限循环,因为您在行状态处理程序中选择了新的行(反转行选择)。 您可以尝试使用参数来避免选择行一个您已经在函数中(它应该告诉状态发生变化的行)对此有一些想法:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/big class.jmp");
tableCount = 0;
theRows = [];
filepath = "$Desktop";
f = Function({a},
// Set dupRows to the previously selected rows
dupRows = theRows;
// Get the current selected rows
theRows = a;
If(N Rows(theRows) > 0,
// check to see if there are the same number of rows
// then validate the rows are different rows before saving
If(N Rows(theRows) == N Rows(dupRows),
If(Sum(dupRows == theRows) != N Rows(theRows),
tableCount++;
dtTemp = dt << subset(invisible, rows(theRows), selected columns(0));
dtSEG = dt << subset(rows(dupRows), selected columns(0));
Close(dtTemp, save(filepath || "\" || "part" || ".jmp"));
Close(dtSEG, save(filepath || "\" || "seg2" || ".jmp"));
)
,
// If not the same number of selected rows, save the subset
tableCount++;
dtTemp = dt << subset(invisible, rows(theRows), selected columns(0));
dtSEG = dt << subset(rows(dupRows), selected columns(0));
Close(dtTemp, save(filepath || "\" || "part" || Char(tableCount) || ".jmp"));
Close(dtSEG, save(filepath || "\" || "seg2" || Char(tableCount) || ".jmp"));
)
);
Show(a, tableCount); //debug print
);
rs = Current Data Table() << make row state handler(f);我很可能会避免行状态处理程序并使用某种新窗口,用户可以在其中选择完成后按下按钮。 这是因为我在行状态处理程序方面遇到了一些问题,并尽可能避免它们。
感谢您的帮助。 现在,它工作正常,我删除了行状态处理程序并使用了一个在关闭窗口时调用的函数。 这会创建两个子集。