I have a set of specifications that a product in production would need to pass. I have a column with a formula that specifies the values needed (Limits) by each specification, and creates a binary pass/fail. This formula is used to create a Pareto Graph of passing number and percentage. I want to create an interactive Pareto Graph with slider boxes to adjust the testing limits, and see how changing these limits would change the amount of items passing/failing the test.
My main two problems are as follows:
1) There are multiple product types that will be tested. I wont have a consistent number of specifications per product, so I plan on inserting these specs into an list,(in the code attached that would be "spec") and using an external data table to fill in those specs for the desired product. This isn't something I need help with, but is something to consider as I will have to input slider boxes, number boxes, and so on in a for loop without directly referencing the variables.
2) I need an array of variables (spec limits) so that I can update the formula for testing purposes. Again this will need to be in a for loop. As the script stands right now, it appears the values of spec limits are not updating the in the formula for the pass/fail column. When the slider box receives the << inval command and the graph refreshes, nothing is happening as the actual pass/fail column isn't updated. I'm currently using an associative array to store the spec limits. This may not be the correct way to do this.
I have attached the sample data table I am using as well as the current script. Thanks!
Names default to here(1);
RangeMin = Associative array(["m1" => 0,
"m2" => 0,
"m3" => 0,
"thickness" => 0]);
RangeMax = Associative array(["m1" => 1,
"m2" =>1,
"m3" => 1,
"thickness" => 20]);
limit = Associative array(["m1" => 0.5,
"m2" => 0.5,
"m3" => 0,
"thickness" => 4]);
SliderVars = {0.5,0.5,0.5,10};
spec = {"m1","m2","m3","thickness"};
GraphingTable = current data table();
finalDisplay = New Window ("test", testlist = h list box());
:name("Pass/Fail") << Set Formula(
if((:thickness >= limit["thickness"] & :m3 >= limit["m3"] & m2 >= limit["m2"] & m1 >= limit["m1"]), "Pass", "Fail" )
);
PP= Graphing Table << Pareto Plot( Cause( :"Pass/Fail"n ) );
ValuesOutlineBox = Outline Box ( "Values", SliderList = v list box());
For(i=1, i<= n items(spec),i++,
SliderList << append(
h list box(
Text box(spec[i]),
testing = spec[i];
eval(
parse(
eval insert(
"Var^char(i)^ = ^SliderVars[i]^;
SB^char(i)^ = Slider Box(
^RangeMin << get value(spec[i])^,
^RangeMax << get value(spec[i])^,
Var^char(i)^,
NEB^char(i)^ << set( Var^char(i)^ );
limit[testing] = Var^char(i)^;
testlist[2] << Delete Box();
wait(0.1);
testlist << append(report(PP));
);"
);
);
),
testing = spec[i];
eval(
parse(
eval insert(
"NEB^char(i)^ = Number Edit Box( Var^char(i)^,
<< set function(
Function( {this},
Var^char(i)^ = this << get;
SB^char(i)^ << inval;
limit[testing] = Var^char(i)^;
testlist[2] << Delete Box();
wait(0.1);
testlist << append(report(PP));
)
)
);"
);
);
),
)
)
);
testlist << append(ValuesOutlineBox);
testlist << append(report(PP));
Josh