你好,
常见的请求是在表格框列上方创建一种搜索栏,类似于在其他可视化软件中所做的。
目的是能够非常轻松地使用不同的过滤器来过滤数据表。
例如,在下面的示例中,如果我在“验证状态”列顶部的搜索框中输入“Pend”,在“分发确认”列顶部的搜索框中输入“Yes”,它将根据这两个过滤器过滤表格:验证状态包含“Pend”且另一列包含“yes”的每一行。
我知道我们可以使用数据过滤器,而且我问的实际上是关于 JSL 脚本,但是有没有人有同样的请求并成功概括出生成这种表格框的功能?

这已经是 JMP 愿望清单中的一项了。您可以点击此处查看
创建类似这样的基础版本并不太复杂,但创建一个健壮且美观的版本很可能会有些复杂。下面的示例是基础的。
查看更多...
Names Default To Here(1);
filter_tablebox = function({tb, options},
aa = Associative Array(tb << get names, options << get text);
filter_expr = {};
For Each({{colname, filter_text}}, aa,
If(Is Missing(filter_text),
continue(); // skip over
);
Insert Into(filter_expr, EvalExpr(Contains(Lowercase(Expr(As Name(colname))), Expr(filter_text))));
);
If(N Items(filter_expr) == 0,
tb << Reset Filter;
return(1);
);
If(N Items(filter_expr) == 1,
filter_expr = filter_expr[1];
,
Substitute Into(filter_expr, Expr(List()), Expr(And()));
);
Eval(EvalExpr(tb << Filter Where(Expr(Name Expr(filter_expr)))));
return(1);
);
nw = New Window("Example",
ob = Outline Box("Table",
V List Box(
hlb = H List Box(
Text Edit Box("", << Set Script(filter_tablebox(tb1, hlb << XPath("//TextEditBox"))), << Set Width(51)),
Text Edit Box("", << Set Script(filter_tablebox(tb1, hlb << XPath("//TextEditBox"))), << Set Width(80)),
),
tb1 = Table Box(
String Col Box("Mountain", {"K2", "Delphi", "Kilimanjaro", "Grand Teton"}),
String Col Box("TEST", {"x", "y", "z", "a"})
)
)
)
);
非常感谢,就是这个!基础版已经解决了我的问题,完美!
如果表格框使用的是数据表列框,它似乎不再支持“筛选位置”,这会阻止您使用此功能。使用数据表框的理由是什么?您是否希望拥有与原始表格或其他表格关联的行选择功能?
只是,使用数据表框时,我直接拥有数据表,而使用表格框时,我必须将表格转换为表格框。我确实尝试过调整你的数据表脚本,但卡在了过滤器上,不知道是不是我操作错了。
您可以使用<<获取报告将数据表转换为表框(没有花哨的数据表列框)
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(4),
Compress File When Saved(1),
New Column("Mountain",
Character,
"Nominal",
Set Values({"K2", "Delphi", "Kilimanjaro", "Grand Teton"})
),
New Column("TEST", Character, "Nominal", Set Values({"x", "y", "z", "a"}))
);
filter_tablebox = function({tb, options},
aa = Associative Array(tb << get names, options << get text);
filter_expr = {};
For Each({{colname, filter_text}}, aa,
If(Is Missing(filter_text),
continue(); // skip over
);
Insert Into(filter_expr, EvalExpr(Contains(Lowercase(Expr(As Name(colname))), Expr(filter_text))));
);
If(N Items(filter_expr) == 0,
tb << Reset Filter;
return(1);
);
If(N Items(filter_expr) == 1,
filter_expr = filter_expr[1];
,
Substitute Into(filter_expr, Expr(List()), Expr(And()));
);
Eval(EvalExpr(tb << Filter Where(Expr(Name Expr(filter_expr)))));
return(1);
);
nw = New Window("Example",
ob = Outline Box("Table",
V List Box(
hlb = H List Box(
Text Edit Box("", << Set Script(filter_tablebox(tb1, hlb << XPath("//TextEditBox"))), << Set Width(80)),
Text Edit Box("", << Set Script(filter_tablebox(tb1, hlb << XPath("//TextEditBox"))), << Set Width(51)),
),
rep = dt << get as report; // repo is border box and under it is table box
)
)
);
tb1 = rep << child;
rep << Left (0);
rep << Top(0);
rep << Bottom(0);
非常感谢 !!!!! 我不知道转换起来竟然如此简单,只需获取报告即可!