你好,
我正在為用戶構建一個簡單的界面,並有一個窗口來使用複選框設置一些選項。
我目前能夠進行第一個調用函數,腳本從列中過濾字符串“SE”並生成異常值。 但是,如果我選中第二個和第三個複選框,它不會調用該函數
我嘗試了以下腳本:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Water Treatment.jmp");
check_list = {"SS", "SE", "PH"};
todo_list = {};
nw = new window("Checkboxes", << modal(),
my_cb = checkbox(check_list),
panelbox("Actions",
hlistbox(
button box("OK",
keep_going = 1;
todo_list = my_cb << get selected;
),
button box("Cancel", keep_going = 0)
),
),
);
nt = nitems(todo_list);
colList = dt << Get Column Names("String");
filteredCols = {};
if (keep_going & nt > 0,
for (i = 1, i <= nt, i++,
if (todo_list[i] == "SS",
// Call function for One step
For(i = 1, i <= N Items(colList), i++,
If(Contains(colList[i], "SS"), Insert Into(filteredCols, colList[i]))
);
obj = dt <<
Explore Outliers(
Y((Eval(filteredCols) )));
obj << Quantile Range Outliers;
obj << Select Rows(All);
,
todo_list[i] == "SE",
// Call function for Two step
For(i = 1, i <= N Items(colList), i++,
If(Contains(colList[i], "SE"), Insert Into(filteredCols, colList[i]))
);
obj = dt <<
Explore Outliers(
Y((Eval(filteredCols) )));
obj << Quantile Range Outliers;
obj << Select Rows(All);
,
todo_list[i] == "PH",
// Call function for Three step
For(i = 1, i <= N Items(colList), i++,
If(Contains(colList[i], "PH"), Insert Into(filteredCols, colList[i]))
);
obj = dt <<
Explore Outliers(
Y((Eval(filteredCols) )));
obj << Quantile Range Outliers;
obj << Select Rows(All);
);
);
);尋找一些回饋
謝謝,
傑克
您正在為所有 For() 循環使用索引“i”。這意味著“i”的值到處都在變化。當循環中存在循環時,您需要為 For() 循環使用不同的變量。