你好,
我正在为用户构建一个简单的界面,并有一个窗口来使用复选框设置一些选项。
我目前能够进行第一个调用函数,脚本从列中过滤字符串“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() 循环使用不同的变量。