這與分區腳本有關,我試圖在分區函數之後將選定的和未選定的行保存為不同的表。 但是當我這樣做時,整個 JSL 腳本就會進入無限循環。 有什麼辦法可以解決這個問題嗎?
感謝您的協助。 現在,它工作正常,我已經刪除了行狀態處理程序並使用了在視窗關閉時調用的函數。 這將建立兩個子集。
我猜它會進入無限循環,因為您在行狀態處理程序中對行進行了新的選擇(反轉行選擇)。 您可以嘗試使用參數來避免選擇行A您已經在函數中(它應該告訴狀態已更改的行)對此有一些了解:
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);我很可能會避免使用行狀態處理程序並使用某種新窗口,用戶可以在完成選擇後按下按鈕。 這是因為我在行狀態處理程序方面遇到了一些問題,並儘可能避免它們。