Hi everyone,
I have no idea why my post was marked as spam. It is an important question and I would really appreciate if my question could be posted.
Link to post:
(Using Number Edit Boxes to change Spec Limits in Column Properties and Column Formula)
by Marco_
https://community.jmp.com/t5/Discussions/Using-Number-Edit-Boxes-to-change-Spec-Limits-in-Column/m-p/620278#M81951
Hi everyone, I want to use the following script to define in a pop-up window the lower and upper spec limits (LSL and USL) and use the values in order to set the column properties for the spec limits. On top of that, I have a formula column called "check", where I want to use the values within the formula to check if the value in the row is within the spec ranges or not. The code is running but the values are not entered for the spec limits or in the formula. // Just some code to create a test tableNew Table( "test",
Add Rows( 10 ),
New Column( "LA",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[4172.33500363846, 4003.0454164522, 5132.51142953179, 4254.16795732848,
4202.75172580535, 3574.47256743923, 3804.96534319603, 3915.70034276743,
4319.47567126139, 4094.59235385003]
),
Set Display Width( 73 )
),
New Column( "UA",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[59507.3313010261, 53541.4856212676, 71149.6162777807, 59578.8338627777,
56630.4195099436, 50900.019384575, 51479.1947874623, 53642.2158390849,
61673.2466126228, 56337.4407587715]
),
Set Display Width( 73 )
),
New Column( "95CIupr SD LA",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[1043.86456772353, 876.888513223994, 1136.27463369684, 970.028749878648,
954.598082854551, 941.489444193772, 846.345601078669, 801.488231630083,
973.917277695926, 934.431089864531]
),
Set Display Width( 81 )
),
New Column( "95CIupr SD UA",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[3068.69934323136, 2352.88265793793, 4263.23712733597, 2974.99490133574,
2684.01670727501, 2048.97811082407, 2128.8899692482, 2298.27809836615,
3264.19929423158, 2671.90896127954]
),
Set Display Width( 83 )
)
)
//define default values for number edit boxes
UA_LSL = 0.8; // numbers with default
UA_USL = 1.2; // number with default
UA_LA_LSL = 0.8; // number with default
UA_LA_USL = 1.2; // number with default
//code for the pop-up window
w = New Window( "SST simulation", <<modal, // opens a window with a title and this content...
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H Center Box( Text Box( "Define SST Options" ) ), // a second title, centered
Spacer Box( size( 1, 30 ) ), // a little vertical space
H List Box( Text Box( "UA1/UA2 LSL and USL: " ), meta_UA_LSL = Number Edit Box( UA_LSL ), meta_UA_USL = Number Edit Box( UA_USL ) ), // data entry
Spacer Box(size(1, 10)),
H List Box( Text Box( "UA1-LA1/UA2-LA2 LSL and USL: " ), meta_UA_LA_LSL = Number Edit Box( UA_LA_LSL ), meta_UA_LA_USL = Number Edit Box( UA_LA_USL ) ), // data entry
Spacer Box(size(1, 10)),
H List Box( // center the button
Button Box( "OK", // this script runs when the button is pressed...
UA_LSL = meta_UA_LSL << get;
UA_USL = meta_UA_USL << get;
UA_LA_LSL = meta_UA_LA_LSL << get;
UA_LA_USL = meta_UA_LA_USL << get;
),
Spacer Box(size(10, 1)),
Button Box("Cancel")
//w << closeWindow; // close the dialog
)
)
)
);
// If cancel or X was clicked, stop the script
If( w == {Button( -1 )}, Stop() );
//code to to change spec limits in column properties and column formulas
dt = Current Data Table();
// Paste columns
dt << New Column( "UA1/UA2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Property(
"Spec Limits",
{LSL( UA_LSL ), USL( UA_USL ), Target( 1 ), Show Limits( 1 )}
),
Formula(
Random Normal( :UA, :"95CIupr SE UA n = 2"n ) /
Random Normal( :UA, :"95CIupr SE UA n = 2"n )
),
Set Selected,
Set Display Width( 73 )
) << New Column( "UA1-LA1/UA2-LA2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Property(
"Spec Limits",
{LSL( print(UA_LA_LSL) ), USL( UA_LA_USL ), Target( 1 ), Show Limits( 1 )}
),
Formula(
(Random Normal( :UA, :"95CIupr SE UA n = 2"n )
-Random Normal( :LA, :"95CIupr SE LA n = 2"n )) / (
Random Normal( :UA, :"95CIupr SE UA n = 2"n )
-Random Normal( :LA, :"95CIupr SE LA n = 2"n ))
),
Set Selected,
Set Display Width( 106 )
) << New Column( "Check",
Character( 7 ),
"Nominal",
Formula(
If(
:"UA1/UA2"n < UA_LSL | :"UA1/UA2"n
> UA_USL | :"UA1-LA1/UA2-LA2"n < UA_LA_LSL | :"UA1-LA1/UA2-LA2"n > UA_LA_USL,
"Outside",
"Inside"
)
),
Set Selected,
Set Display Width( 50 )
);
Greetings /Marco
This message has 0 replies