Re: 如何根据用户输入的值自动的改变制表平台里的合格率?Es gibt mehrere Ansätze. Das folgende ist ein Beispiel, das die eval-Einfügefunktion verwendet.
Das Seite ist auch hilfreich, um den Ausdruck zu verstehen.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
create tabulate = Expr(
Parse(
Eval Insert(
"\[
tabulate box = dt << Tabulate(
Set Format(
Mean(
:Name( "age" )(6, "Best"),
:Name( "height" )(6, "Best"),
:Name( "weight" )(6, "Best"),
Analysis Columns(
Transform Column(
"age rate",
Formula ( if(:age ^aglf^ ^agel^ & :age ^aguf^ ^ageu^ ,1,0) ),
Format( 9, 2, "Percent" )
)
),
Analysis Columns(
Transform Column(
"height rate",
Formula( if(:height ^helf^ ^heil^ & :height ^heuf^ ^heiu^ ,1,0) )
),
//强行修改格式
Format( 9, 2, "Percent" )
),
Analysis Columns(
Transform Column(
"weight rate",
Formula( if(:weight ^welf^ ^weil^ & :weight ^weuf^ ^weiu^ ,1,0) )
),
Format( 9, 2, "Percent" )
)
),
N( 9, "Best" )
),
Add Table(
Column Table(
//具体固定统计列
Analysis Columns( :Name( "age" ), :Name( "weight" ), :Name( "height" ) ),
Statistics( Mean, Range )
),
//调整样本量列的实际位置
Column Table( Statistics( N ) ),
column table(
Analysis Columns(
Transform Column(
"rate age",
Formula( if(:age ^aguf^ ^agel^ & :age ^aguf^ ^ageu^ ,1,0) )
)
),
Statistics( Mean )
),
Column Table(
Analysis Columns(
Transform Column(
"height rate",
Formula( if(:height ^helf^ ^heil^ & :height ^heuf^ ^heiu^ ,1,0) )
)
),
Statistics( Mean )
),
Column Table(
Analysis Columns(
Transform Column(
"weight rate",
Formula( if(:weight ^welf^ ^weil^ & :weight ^weuf^ ^weiu^ ,1,0) )
)
),
Statistics( Mean )
),
//临时固定类别列,且可以通过拖拽进行增删
Row Table( Grouping Columns( :sex ) )
)
)
]\"
)
)
);
nw = New Window( "合格率报表",
Data Filter Context Box(
H List Box(
dfsb = Current Data Table() << Data Filter( Local ),
Platform(
Current Data Table(),
V List Box(
Outline Box( "请输入所有参数规格限",
Lineup Box( N Col( 3 ), Spacing( 5 ),
Panel Box( "age",
Lineup Box( N Col( 3 ), Spacing( 5 ),
Text Box( "upper " ),
dluf = Combo Box( {"<=", "<"} ),
dlu = Number Edit Box( 15 ),
Text Box( "lower " ),
dlbf = Combo Box( {">=", ">"} ),
dlb = Number Edit Box( -3 )
)
),
Panel Box( "height",
Lineup Box( N Col( 3 ), Spacing( 5 ),
Text Box( "upper " ),
dauf = Combo Box( {"<=", "<"} ),
dau = Number Edit Box( 15 ),
Text Box( "lower " ),
dabf = Combo Box( {">=", ">"} ),
dab = Number Edit Box( 1 )
)
),
Panel Box( "weight",
Lineup Box( N Col( 3 ), Spacing( 5 ),
Text Box( "upper " ),
dbuf = Combo Box( {"<=", "<"} ),
dbu = Number Edit Box( 15 ),
Text Box( "lower " ),
dbbf = Combo Box( {">=", ">"} ),
dbb = Number Edit Box( 1 )
)
),
Button Box( "确定",
//获取规格限数字
ageu = dlu << get;
agel = dlb << get;
heiu = dau << get;
heil = dab << get;
weiu = dbu << get;
weil = dbb << get;
//获取规格限数字是否包含
aguf = ((dluf << XPath( "//ComboBox" )) << get selected)[1];
aglf = ((dlbf << XPath( "//ComboBox" )) << get selected)[1];
heuf = ((dauf << XPath( "//ComboBox" )) << get selected)[1];
helf = ((dabf << XPath( "//ComboBox" )) << get selected)[1];
weuf = ((dbuf << XPath( "//ComboBox" )) << get selected)[1];
welf = ((dbbf << XPath( "//ComboBox" )) << get selected)[1];
Try( tabulate box << delete );
tabulate << append( Eval( create tabulate ) );
)
)
),
//
tabulate = V List Box();
//
)
)
)
)
);Betreff: Wie ändert man automatisch die Qualifizierungsrate in der Tabellierungsplattform entsprechend dem vom Benutzer eingegebenen Wert?Vielen Dank, darf ich Sie fragen? Warum sollte "||" durch "&" ersetzt werden?
Re: 如何根据用户输入的值自动的改变制表平台里的合格率?Es scheint, dass Ihre ursprüngliche Formel so lautet: "If (:age >= 8:age < 20, 1, 0);".
Ich dachte, Sie brauchen einen and-Operator in der Formel. "If(:age >= 8 & :age < 20, 1, 0);".
Wenn Sie die eval-Einfügefunktion verwenden, müssen Sie "||" nicht hinzufügen. in diesem Beispiel.
aglf = ">=";
agel = 8;
aguf = "<";
ageu = 20;
example1 = eval insert("if(:age ^aglf^ ^agel^ & :age ^aguf^ ^ageu^ ,1,0)");
Show( example1 );Wie kann die Erfolgsquote in der Tabellierungsplattform automatisch entsprechend dem vom Benutzer eingegebenen Wert geändert werden?Vielen Dank, ich bin ein Neuling. Bitte fragen Sie, wie Sie das vom Benutzer eingegebene Vergleichssymbol und den Wert in die JSL-Berechnung einbeziehen können. Ich verwende eval(parse()), kann dies jedoch nicht realisieren, danke.
names default to here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Window( "合格率报表",
Data Filter Context Box(
H List Box(
dfsb = Current Data Table() << Data Filter( Local ),
Platform(
Current Data Table(),
V List Box(
Outline Box( "请输入所有参数规格限",
Lineup Box( N Col( 3 ), Spacing( 5 ),
Panel Box( "age",
Lineup Box( N Col( 3 ), Spacing( 5 ),
Text Box( "upper " ),
dluf = Combo Box( {"<=", "<"} ),
dlu = Number Edit Box(15),
Text Box( "lower " ),
dlbf = Combo Box( {">=", ">"} ),
dlb = Number Edit Box(-3)
)
),
Panel Box( "height",
Lineup Box( N Col( 3 ), Spacing( 5 ),
Text Box( "upper " ),
dauf = Combo Box( {"<=", "<"} ),
dau = Number Edit Box(),
Text Box( "lower " ),
dabf = Combo Box( {">=", ">"} ),
dab = Number Edit Box()
)
),
Panel Box( "weight",
Lineup Box( N Col( 3 ), Spacing( 5 ),
Text Box( "upper " ),
dbuf = Combo Box( {"<=", "<"} ),
dbu = Number Edit Box(),
Text Box( "lower " ),
dbbf = Combo Box( {">=", ">"} ),
dbb = Number Edit Box()
)
),
Button Box( "确定",
//获取规格限数字
ageu = dlu << get;
agel = dlb << get;
heiu = dau << get;
heil = dab << get;
weiu = dbu << get;
weil = dbb << get;
//获取规格限数字是否包含
aguf = ((dluf << XPath( "//ComboBox" )) << get selected)[1];
aglf = ((dlbf << XPath( "//ComboBox" )) << get selected)[1];
heuf = ((dauf << XPath( "//ComboBox" )) << get selected)[1];
helf = ((dabf << XPath( "//ComboBox" )) << get selected)[1];
weuf = ((dbuf << XPath( "//ComboBox" )) << get selected)[1];
welf = ((dbbf << XPath( "//ComboBox" )) << get selected)[1];
)
)
),
dt << Tabulate(
Set Format(
Mean(
:Name( "age" )(6, "Best"),
:Name( "height" )(6, "Best"),
:Name( "weight")(6, "Best"),
Analysis Columns(
Transform Column( "age rate", eval(parse("if(:age"||aglf|| char(agel)|| ":age"||aguf||char(ageu)||",1,0)")) ,
Format( 9, 2, "Percent" )
)),
Analysis Columns(
Transform Column( "height rate", Formula( eval(parse("if(:height"||helf|| char(heil)|| ":height"||heuf||char(heiu)||",1,0)")) ) ),
//强行修改格式
Format( 9, 2, "Percent" )
),
Analysis Columns( Transform Column( "weight rate", Formula( eval(parse("if(:weight"||welf|| char(weil)|| ":weight"||weuf||char(weiu)||",1,0)")) ) ), Format( 9, 2, "Percent" ) )
),
N( 9, "Best" )
),
Add Table(
Column Table(
//具体固定统计列
Analysis Columns( :Name( "age" ), :Name( "weight" ), :Name( "height" ) ),
Statistics( Mean, Range )
),
//调整样本量列的实际位置
Column Table( Statistics( N ) ),
column table(Analysis Columns(
Transform Column( "rate age", Formula( eval(parse("if(:age"||aguf|| char(agel)|| ":age"||aguf||char(ageu)||",1,0)"))) ) ),Statistics( Mean )
),
Column Table(
Analysis Columns( Transform Column( "height rate", Formula( eval(parse("if(:height"||helf|| char(heil)|| ":height"||heuf||char(heiu)||",1,0)")) ) ) ),
Statistics( Mean )
),
Column Table(
Analysis Columns( Transform Column( "weight rate", Formula( eval(parse("if(:weight"||welf|| char(weil)|| ":weight"||weuf||char(weiu)||",1,0)")) ) ) ),
Statistics( Mean )
),
//临时固定类别列,且可以通过拖拽进行增删
Row Table( Grouping Columns( :sex ) )
)
);
)))))Erweiterte statistische ModellierungAutomatisierung und SkripterstellungMac OS