如何编写列匹配对话框脚本我有一个对话框,需要用户匹配列对。 与我们在连接表中所做的非常相似。

具体示例 - 我有一组实验测量的参数和一组理论预测。 这些数据来自不同的来源,并且列命名可以是任意的,因此我需要用户将每个参数的理论与实验进行匹配。
有关于如何编写这部分脚本的示例吗? 以及如何保留这些对以及以后如何使用它们?
到目前为止,我已经有了这个,我感兴趣的是如何编写绿框中的框脚本以反映匹配对(如上面的示例)以及如何保留这些对(2 个项目列表的列表?)以及如何删除\召回他们等:

这是脚本:
dt = New Table( "Untitled 5",
Add Rows( 4 ),
Set Header Height( 46 ),
New Column( "X", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 2, 3, 4] ) ),
New Column( "A_Theory", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 3, 2, 3] ) ),
New Column( "B_Measured", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [4, 5, 6, 5] ) ),
New Column( "A_Measured", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 4, 3, 4] ) ),
New Column( "B_Theory", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [4, 5, 3, 4] ) )
);
notImplemented = Expr(
win = New Window( "Feature Not Implemented Yet", <<MODAL></MODAL>
数据混合和清理回复:如何编写列匹配对话框脚本根据应用程序的工作方式,在用户按下运行/确定按钮之前最好不要将值附加到列表中,因为用户可能希望从列表框中删除值(当前不可能)。
我在此示例中添加了 Run 按钮和 runExpr(如果没有 JMP16,您可以将 Transform Each 修改为 For 循环,该循环会将值追加到列表中),删除按钮并在按下 Match 时清除 col 列表框选择:
Names Default To Here(1);
matchedList = {};
dt = New Table("Untitled 5",
Add Rows(4),
Set Header Height(46),
New Column("X", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 4])),
New Column("A_Theory", Numeric, "Continuous", Format("Best", 12), Set Values([1, 3, 2, 3])),
New Column("B_Measured", Numeric, "Continuous", Format("Best", 12), Set Values([4, 5, 6, 5])),
New Column("A_Measured", Numeric, "Continuous", Format("Best", 12), Set Values([1, 4, 3, 4])),
New Column("B_Theory", Numeric, "Continuous", Format("Best", 12), Set Values([4, 5, 3, 4]))
);
notImplemented = Expr(
a = (clb1 << get selected)[1];
b = (clb2 << get selected)[1];
clb1 << Clear selection;
clb2 << Clear selection;
lb << Append(a || "=" || b);
);
notImplemented2 = Expr(
lb << Remove Selected;
);
runExpr = Expr(
lb << get items;
lb_values = Transform Each({val}, lb << get items, Words(val, "="));
show(lb_values);
);
gui = Expr(
H List Box(
V List Box(
Panel Box("Theory",
clb1 = Col List Box(All, Nlines(5))
),
Panel Box("Experiment",
clb2 = Col List Box(All, Nlines(5))
)
),
Panel Box("Theory vs Experiment Matching",
H List Box(
Lineup box(N Col(1),
Button Box("Match", notImplemented),
Button Box("Remove", notImplemented2),
),
lb = List Box({}, Nlines(12))
)
),
Panel Box("Actions",
Button Box("Run",
runExpr;
)
)
)
);
fileLoad = New Window("Example", Show Menu(0), Show Toolbars(0), gui);
回复:如何编写列匹配对话框脚本好的,它是这样工作的:
notImplemented = Expr(
a = (clb1 << get selected)[1];
b = (clb2 << get selected)[1];
lb << Append(a || "=" || b);
matchedList[N Items( matchedList ) + 1] = Eval List ({a, b});
//Insert Into(matchedList, Eval List(columnPair));
Show(matchedList);
);回复:如何编写列匹配对话框脚本还有一个问题。 我这样修改脚本:
Names Default To Here(1);
matchedList = {};
dt = New Table("Untitled 5",
Add Rows(4),
Set Header Height(46),
New Column("X", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 4])),
New Column("A_Theory", Numeric, "Continuous", Format("Best", 12), Set Values([1, 3, 2, 3])),
New Column("B_Measured", Numeric, "Continuous", Format("Best", 12), Set Values([4, 5, 6, 5])),
New Column("A_Measured", Numeric, "Continuous", Format("Best", 12), Set Values([1, 4, 3, 4])),
New Column("B_Theory", Numeric, "Continuous", Format("Best", 12), Set Values([4, 5, 3, 4]))
);
notImplemented = Expr(
a = (clb1 << get selected)[1];
b = (clb2 << get selected)[1];
lb << Append(a || "=" || b);
Insert Into(matchedList, {a, b});
Show(matchedList);
);
gui = Expr(
H List Box(
V List Box(
Panel Box("Theory",
clb1 = Col List Box(All, Nlines(5))
),
Panel Box("Experiment",
clb2 = Col List Box(All, Nlines(5))
)
),
Panel Box("Theory vs Experiment Matching",
H List Box(
Button Box("Match", notImplemented),
lb = List Box({}, Nlines(12))
)
)
)
);
fileLoad = New Window("Example", Show Menu(0), Show Toolbars(0), gui);我得到这个:
matchedList = {a, b, a, b};当我期待这个时:
matchedList = {{"A_Theory", "A_Measured"}, {"B_Theory", "B_Measured"}}或者类似的东西,这样我就可以迭代对。
我究竟做错了什么?
回复:如何编写列匹配对话框脚本让我尝试一下。
然后稍后对这些列执行某些操作(例如,为每对绘制“Fit Y by X”)-可以将它们保留为列表的列表吗?
columnPairs = {{A_Theory, A_Experiment}, {B_Theory, B_Experiment}};然后迭代它们还是有更好的选择?
回复:如何编写列匹配对话框脚本如果我不得不猜测,连接平台使用列表框,当您添加列对时,它会在其中附加新值。
Names Default To Here(1);
dt = New Table("Untitled 5",
Add Rows(4),
Set Header Height(46),
New Column("X", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 4])),
New Column("A_Theory", Numeric, "Continuous", Format("Best", 12), Set Values([1, 3, 2, 3])),
New Column("B_Measured", Numeric, "Continuous", Format("Best", 12), Set Values([4, 5, 6, 5])),
New Column("A_Measured", Numeric, "Continuous", Format("Best", 12), Set Values([1, 4, 3, 4])),
New Column("B_Theory", Numeric, "Continuous", Format("Best", 12), Set Values([4, 5, 3, 4]))
);
notImplemented = Expr(
a = clb1 << get selected;
b = clb2 << get selected;
lb << Append(a[1] || "=" || b[1]);
);
gui = Expr(
H List Box(
V List Box(
Panel Box("Theory",
clb1 = Col List Box(All, Nlines(5))
),
Panel Box("Experiment",
clb2 = Col List Box(All, Nlines(5))
)
),
Panel Box("Theory vs Experiment Matching",
H List Box(
Button Box("Match", notImplemented),
lb = List Box({}, Nlines(12))
)
)
)
);
fileLoad = New Window("Example", Show Menu(0), Show Toolbars(0), gui);
//{col1, col2} = Words((lb << get items)[1], "=");

我只是快速地将脚本组合在一起,因此使用比变量更好的命名,防止在列列表框中选择多个值,并删除列索引的硬编码限制。 当您需要可以获取的值时,可以使用 << 将项目获取到列表框引用,这将为您提供项目列表。 然后使用 Words() 将其进一步拆分为不同的部分。