JSL:使用带有列级别的复选框你好,
我希望你一切都好。
我对 JMP 中复选框的脚本有疑问。
我有一个带有“强度”变量的数据集,如果数据集根据呈现数据集中所有强度的复选框,我想创建一个子集。 目的是用户在复选框中检查感兴趣的强度,并且根据在复选框中检查的强度来选择数据集中的行。 由于根据数据集,优势不一定相同,我想知道是否可以从列中“提取”优势的唯一值,然后在复选框中显示优势,以便在复选框中选择兴趣的强项。 我希望脚本尽可能通用,以分析具有所有可能优势的所有数据集。
非常感谢您,祝您有愉快的一天,
让
自动化和脚本编写回复:JSL:使用带有列级别的复选框再一次问好,
我有最后一个问题:如何修改代码以根据复选框中选中的优势来命名每个子集?
非常感谢你,祝你有愉快的一天,
让
回复:JSL:使用带有列级别的复选框都好 !
太感谢了 !
祝你度过愉快的一天,
让
回复:JSL:使用带有列级别的复选框
子集是否存储在 dt2 变量中
仅当您定义 dt2 变量时:)
你可以这样做:
dt2 = dt << subset(
selected rows(1),
selected columns only(0)
);
是否有任何命令可以关闭或隐藏数据集的子集
由于我们刚刚创建了它,我假设我们不想关闭它,但如果您不想让用户看到它,您可以将其设置为不可见:
dt2 = dt << subset( invisible,
selected rows(1),
selected columns only(0)
);
如果我已经在 Jmp 中打开了一个数据集,我如何在dt多变的
您可以将 dt 变量关联到当前打开的表,
dt = current data table();
或者如果有多个打开的表,则通过引用该表:
dt = data table("strength data");
最后,还有一个你没有问过但可能想知道的问题。用户单击按钮创建子集后,如果要关闭包含复选框的窗口,可以将以下行添加到做子集功能:
cr = current report();
cr << close window;
祝你好运。
回复:JSL:使用带有列级别的复选框非常感谢 ! 子集是否存储在 dt2 变量中?
回复:JSL:使用带有列级别的复选框非常感谢 !
最后两个问题:
- 是否有任何命令可以关闭或隐藏数据集的子集?
- 如果我已经在 Jmp 中打开了一个数据集,我如何在 a 中定义它dt多变的?
非常感谢您,祝您有愉快的一天,
让
回复:JSL:使用带有列级别的复选框'foreach' 是版本 16 中的新功能。如果您有旧版本,则可以使用更传统的 for 循环:
for (i=1,i<=nitems(selected),i++,
rows = dt << select where(:Strength==selected[i],
current selection("extend")
);
);回复:JSL:使用带有列级别的复选框大卫您好,非常感谢您的帮助!
但是,当执行代码时,出现以下错误:

我该如何修复它?
非常感谢您,祝您有愉快的一天,
让
回复:JSL:使用带有列级别的复选框另一个例子:
Names Default to Here( 1 );
// mock up data set with Strength
dt = New Table( "Strength",
New Column( "Strength", "Character", "Nominal",
Values( {"Intelligent", "Innovative", "Initiative", "Introvert", "Intelligent",
"Innovative", "Initiative", "Introvert", "Intelligent", "Innovative",
"Initiative", "Introvert"} )
)
);
// get unique values from the strength column
summarize(dt,levels=by(:strength));
// construct a window containing checkboxes
NewWindow("Selection",
BorderBox(top(20),bottom(20),left(20),right(20),
VListBox(
TextBox("Select values:"),
here:cb = CheckBox(levels),
SpacerBox(size(0,20)),
ButtonBox("Create Subset",doSubset())
)
)
);
// define function to perform when button is cliccked
doSubset = function({},{default local},
dt = current data table();
dt << clear select;
// get user selections
selected = here:cb << get selected;
// iterate over each of the selected values
// and select the associated rows
for each( {selection},selected,
rows = dt << select where(:Strength==selection,
current selection("extend")
);
);
// create a subset table
dt << subset(
selected rows(1),
selected columns only(0)
);
dt << clear select;
);
回复:JSL:使用带有列级别的复选框这个例子说明了一种可能有效的方法。
Names Default to Here( 1 );
// mock up data set with Strength
dt = New Table( "Strength",
New Column( "Strength", "Character", "Nominal",
Values( {"Intelligent", "Innovative", "Initiative", "Introvert", "Intelligent",
"Innovative", "Initiative", "Introvert", "Intelligent", "Innovative",
"Initiative", "Introvert"} )
)
);
// present user with choices
choice = Associative Array( :Strength ) << Get Keys;
New Window( "Choose Strengths",
Outline Box( "Pick Your Strengths from the Choices Below",
Panel Box( "Strengths",
Check Box( choice,
<< Set Function(
Function( { me, index }, { Default Local },
selection = me << Get Selected;
n = N Items( selection );
dt << Clear Select;
If(
n == 1,
Eval(
Substitute(
Expr( dt << Select Where( :Strength == sss ) ),
Expr( sss ), Name Expr( selection[1] )
)
),
n > 0,
sel expr = Expr( Or() );
For( i = 1, i <= n, i++,
equality = Substitute(
Expr( :Strength == ccc ),
Expr( ccc ), selection[i]
);
Insert Into( sel expr, Name Expr( equality ) );
);
Eval(
Substitute(
Expr( dt << Select Where( eee ) ),
Expr( eee ), Name Expr( sel expr )
)
);
);
);
)
)
)
)
);