我有一个名为 dt 的表。我取一些列的唯一值,并创建以下菜单,使最终用户能够根据列的值过滤 dt 表并取其中的子集。

但是,采用其列的唯一值是有风险的,因为您最终可能会选择表中不存在的属性组合。
有什么方法可以使这个菜单具有交互性或动态性,以便在最终用户做出某些选择时缩小可用的选择范围?
一般来说,有没有什么办法可以处理这个由于初始数据集不包含属性唯一值的所有组合而最终出现空表的问题?
您可以尝试使用条件数据过滤器,但它可能会扰乱您的布局/需要一些额外的工作才能使其看起来相似。
这是一个简单的例子。我建议让引用更加健壮,并可能使用本地数据过滤器而不是全局数据过滤器。你还应该对此进行参数化(包装、说明等)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Animals.jmp");
nw = New Window("",
V List Box(align("center"),
Text Box("Animals Study Evaluation", << Set Base Font("Title")),
Text Box("Add-in version 1.0", << Set Base Font("Heading")),
Text Box("Documentation report: xxxxxx", << Set Base Font("Heading")),
Panel Box("Study Selections",
Button Box("Start Over", f << Clear);
f = dt << Data Filter(
Conditional,
Show Controls(0),
Show Modes(0),
Show Histograms and Bars(0),
Add Filter(
columns(:season, :species, :subject),
Where(:season == "fall"), // force conditional filter order
Where(:species = "COYOTE"),
Where(:subject= "1"),
Display(:season, N Items(4)),
Display(:species, N Items(2), "List Display"),
Display(:subject, N Items(3), "List Display")
)
)
)
)
);
Window("")["Data Filter",BorderBox(6)] << Sib Prepend(
V List Box(
Text Box("Selection of Seasons", << Set Font Size(12), << Set Font Style("Bold Italic")),
Text Box("Please select which seasons to use for the analysis. Multiple seasons can be selected by holding 'ctrl' down while pressing multiple seasons.", << Set Wrap(400))
)
);
Window("")["Data Filter",BorderBox(6)] << Sib Append(Spacer Box(Size(0, 20)));
Window("")["Data Filter",BorderBox(7)] << Sib Prepend(
V List Box(
Text Box("Selection of Species", << Set Font Size(12), << Set Font Style("Bold Italic")),
Text Box("Please select which Species to use for the analysis. Multiple Species can be selected by holding 'ctrl' down while pressing multiple Species.", << Set Wrap(400))
)
);
Window("")["Data Filter",BorderBox(7)] << Sib Append(Spacer Box(Size(0, 20)));
Window("")["Data Filter",BorderBox(8)] << Sib Prepend(
V List Box(
Text Box("Selection of Subjects", << Set Font Size(12), << Set Font Style("Bold Italic")),
Text Box("Please select which Subjects to use for the analysis. Multiple Subjects can be selected by holding 'ctrl' down while pressing multiple Subjects.", << Set Wrap(400))
)
);
Window("")["Data Filter",BorderBox(3)] << Visibility("Collapse");
Window("")["Data Filter",CheckBoxBox(1)] << Visibility("Collapse");
Window("")["Data Filter",BorderBox(1)] << Visibility("Collapse");
nw[Outline Box(1)] << Set Title("");
// To force the order of conditional filtering
// https://community.jmp.com/t5/JMP-Wish-List/Option-to-make-Conditional-Data-Filter-work-from-top-to-bottom/idi-p/746949
f << (Filter Column(:subject) << Clear Selection);
f << (Filter Column(:species) << Clear Selection);
f << (Filter Column(:season) << Clear Selection);

JMP 也在一些地方使用了类似的东西(例如样本索引),但他们也可能使用比我们更好的一些实现。
是否可以在两个数据过滤条件之间使用“或”语句?条件数据过滤器使用“和”语句并动态过滤数据。但如果我的条件如下,该怎么办:
Condition_of_column1 和 (Condition2_of_column2 或 Condition3_of_column3)