這與分區腳本有關,我試圖在分區功能後將選定和未選定的行保存為不同的表。 但是當我這樣做時,整個 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);我很可能會避免行狀態處理程序並使用某種新窗口,用戶可以在其中選擇完成後按下按鈕。 這是因為我在行狀態處理程序方面遇到了一些問題,並儘可能避免它們。
感謝您的幫助。 現在,它工作正常,我刪除了行狀態處理程序並使用了一個在關閉窗口時調用的函數。 這會創建兩個子集。