looping the process capability functioni am trying to loop thru a bunch of column names selected by user(col_name)
then from those list, the code will run for each individual column
the problem is i cant seem to make the JMP read the col_name[i] as a column ,it just read it as a string
and state the column cannot be found in the data table
/*****************************************************
*********************** Cpk *********************
*****************************************************/
cpk =expr(
for (k=1,k<=n items(col_name),k++
Process Capability(
Process Variables( col_name[i]) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{choice[i] << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config == config[k] )
))
);Re: looping the process capability functionhi, attached is a simplified version of the raw data used
Re: looping the process capability functionPlease provide some sample data to help debug the issue.
Re: looping the process capability functiondoesnt seem to work, i tried printing the subituted config , it appear
but the name of the output still haven change
CPK = Expr(
v list box(
For( i = 1, i <= N Items( choices ), i++,
For( j = 1, j <= N Items( Config ), j++,
;
Eval(
Substitute(
Expr(
Process Capability(
Process Variables( As Column( choices[i] ) ),
Spec Limits(
__choices__(
LSL( FAI_SPECS[choices[i] || " LSL"] ),
Target( FAI_SPECS[choices[i] || " Nominal"] ),
USL( FAI_SPECS[choices[i] || " USL"] )
)
),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{__choices__ << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config == config[j] );//"P1_41_PBO")///":name(\!"" || Config[j] || "\!")")
SendToReport(
Dispatch(
{},
"Individual Detail Reports",
OutlineBox,
{Set Title( __YourConfig__ )}
)
);
);
print(__YourConfig__);
),
Expr( __choices__ ), Parse( ":name(\!"" || choices[i] || "\!")" ),
Expr( __YourConfig__ ), Char( Config[j] )
)
)
;
)
)
)
);Re: looping the process capability functionHere is a simple expansion on the Substitute() function that should give you the results that you want.
CPK = Expr(
For( i = 1, i <= N Items( choices ), i++,
For( j = 1, j <= N Items( Config ), j++,
Print( choices );
Eval(
Substitute(
Expr(
Process Capability(
Process Variables( As Column( choices[i] ) ),
Spec Limits(
__choices__(
LSL( FAI_SPECS[choices[i] || " LSL"] ),
Target( FAI_SPECS[choices[i] || " Nominal"] ),
USL( FAI_SPECS[choices[i] || " USL"] )
)
),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{__choices__ << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config == config[j] );//"P1_41_PBO")///":name(\!"" || Config[j] || "\!")")
SendToReport(
Dispatch(
{},
"Individual Detail Reports",
OutlineBox,
{Set Title( __YourConfig__ )}
)
);
)
),
Expr( __choices__ ), Parse( ":name(\!"" || choices[i] || "\!")" ),
Expr( __YourConfig__ ), Char( Config[j] )
)
)
;
)
)
);Re: looping the process capability functionhi sir,
thank you for your patience in helping me with this jsl script
couldnt had done it without you.
just one more adjustment for this script
how do i set the title?
CPK = Expr(
For( i = 1, i <= n items(choices), i++,
for(j=1,j<=n items(Config),j++,
print(choices);
Eval(
Substitute(
Expr(
Process Capability(
Process Variables(as column(choices[i])) ,
Spec Limits( __choices__( LSL(FAI_SPECS[choices[i] || " LSL"] ), Target( FAI_SPECS[choices[i] || " Nominal"] ), USL( FAI_SPECS[choices[i] || " USL"] ) ) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{ __choices__ << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config ==config[j]);//"P1_41_PBO")///":name(\!"" || Config[j] || "\!")")
SendToReport(
Dispatch(
{},
"Individual Detail Reports",
OutlineBox,
{Set Title( "To the same as config[j]" )}
)
)
)
),
Expr( __choices__ ), Parse( ":name(\!"" || choices[i] || "\!")" )
)
)
)
)
);Re: looping the process capability functionWith the complex column name you are have, JMP needs help in parsing it correctly. The :Name() function needs to be used to show the name as being a name and not something that needs to be executed.
CPK = Expr(
For( i = 1, i <= N Items( choices ), i++,
Print( choices );
Eval(
Substitute(
Expr(
Process Capability(
Process Variables( As Column( choices[i] ) ),
Spec Limits( __choices__( LSL( 400 ), Target( 425 ), USL( 450 ) ) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{__choices__ << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config=="P1_A1_MBO" )
);
Print( "choice: _", __choices__, "_chhoice" );
),
Expr( __choices__ ), Parse( ":name(\!"" || choices[1] || "\!")" )
)
);
)
);
dt=current data table();
choices = { "FAI 37_SPC AK R14 Thickness R14 top - Cu Surface","Filling VIM Total Thickness" };
new window("jo",V list box(cpk));Re: looping the process capability functionthe code worked on the example data table but when i tried it on my data they gave me this error.
the attached is show tht the data im trying to pull
CPK = Expr(
For( i = 1, i <= N Items( choices ), i++,
Print( choices );
Eval(
Substitute(
Expr(
Process Capability(
Process Variables( As Column( choices[i] ) ),
Spec Limits( __choices__( LSL( 400 ), Target( 425 ), USL( 450 ) ) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{__choices__ << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config==P1_A1_MBO )
);
Print( "choice: _", __choices__, "_chhoice" );
),
Expr( __choices__ ), Parse( ":" || choices[1] )
)
);
)
);
dt=current data table();
choices = { "FAI 37_SPC AK R14 Thickness R14 top - Cu Surface","Filling VIM Total Thickness" };
new window("jo",V list box(cpk));{"FAI 37_SPC AK R14 Thickness R14 top - Cu Surface", "Filling VIM Total Thickness"}
Name Unresolved: Config{1} in access or evaluation of 'Config' , :Config/*###*/
This Where-clause for data table 'FAI_Spec 2' resulted in no rows: :Config == P1_A1_MBO
"choice: _"
Name Unresolved: FAI 37_SPC AK R14 Thickness R14 top{1} in access or evaluation of 'FAI 37_SPC AK R14 Thickness R14 top' , :FAI 37_SPC AK R14 Thickness R14 top/*###*/
Re: looping the process capability functionHere is a simplified data table along with the code you supplied, and on my system, it runs without error, including your Print statements
dt = New Table( "Example",
Add Rows( 40 ),
New Column("config",
Character( 1 ),
Set Values(
{"P1_31_PBO", "P1_31_PBO", "P1_31_PBO", "P1_31_PBO", "P1_31_PBO", "M", "M", "M", "P1_31_PBO", "P1_31_PBO", "P1_31_PBO", "M", "M", "M",
"M", "P1_31_PBO", "P1_31_PBO", "P1_31_PBO", "P1_31_PBO", "P1_31_PBO", "M", "M", "M", "M", "M", "M", "M", "P1_31_PBO",
"P1_31_PBO", "M", "M", "M", "M", "M", "P1_31_PBO", "P1_31_PBO", "M", "P1_31_PBO", "M", "M"}
)
),
New Column("height",
Set Values(
[59, 61, 55, 66, 52, 60, 61, 51, 60, 61, 56, 65, 63, 58, 59, 61, 62, 65,
63, 62, 63, 64, 65, 64, 68, 64, 69, 62, 64, 67, 65, 66, 62, 66, 65, 60,
68, 62, 68, 70]
)
)
);
CPK = Expr(
For( i = 1, i <= N Items( choices ), i++,
Print( choices );
Eval(
Substitute(
Expr(
Process Capability(
Process Variables( As Column( choices[i] ) ),
Spec Limits( __choices__( LSL( 400 ), Target( 425 ), USL( 450 ) ) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{__choices__ << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config == "P1_31_PBO" )
);
Print( "choice: _", __choices__, "_chhoice" );
),
Expr( __choices__ ), Parse( ":" || choices[1] )
)
);
)
);
dt=current data table();
choices = { "height" };
cpk;Re: looping the process capability function CPK = Expr(
For( i = 1, i <= n items(choices), i++,
print(choices);
Eval(
Substitute(
Expr(
Process Capability(
Process Variables(as column(choices[i]) ),
Spec Limits( __choices__( LSL( 400 ), Target( 425 ), USL( 450 ) ) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{ __choices__ << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config == "P1_31_PBO" )
);
print("choice: _",__choices__,"_chhoice")
),
Expr( __choices__ ), Parse(":" || choices[1] )
)
)
)
);i tried using print to see what it give but i keep getting "unknown" error
Re: looping the process capability functionTo add to Jim's recommendation, this case would be a good time to use the debugger to examine or watch your variables as you step through lines or at break points.
Re: looping the process capability functionI suggest that you step through the values of "i" and check to see what code is being produced from the Substitution() function for each value of "i"; You should then see why the code doesn't work for certain values of "i"
Re: looping the process capability function///BOX PLOT///
boxplot=expr(
data_filtering;
choices=choice<<GETKEYS></GETKEYS><BR />
//BOX PLOT inner expression//
box_plot_inner_expr=expr(
for(i=1,i<=n items(choices),i++,
FAI_USL=Fai_specs[concat(choices[i]," USL")];
FAI_LSL=Fai_specs[concat(choices[i]," LSL")];
FAI_target=Fai_specs[concat(choices[i]," Nominal")];
print(FAI_USL);
Oneway(
Y(choices[i]),
X( :Config),
All Pairs(
1,
Confidence Quantile( 0 ),
LSD Threshold Matrix( 0 ),
Connecting Letters Report( 0 ),
Ordered Differences Report( 0 )
),
Comparison Circles( 0 ),
Means and Std Dev( 1 ),
Box Plots( 1 ),
Mean Error Bars( 1 ),
Std Dev Lines( 1 ),
Connect Means( 1 ),
Points Jittered( 1 ),
SendToReport(
Dispatch(
{},
OutlineBox,
{
}
),
Dispatch(
{},
"1",
ScaleBox,
{Min( FAI_LSL-10 ), Max(FAI_USL+10 ), Inc( 5 ), Minor Ticks( 1 ),
Add Ref Line( FAI_LSL, "Dashed", "Medium Dark Red", "LSL", 1 ),
Add Ref Line( FAI_USL, "Dashed", "Medium Dark Red", "USL", 1 ),
Add Ref Line( FAI_target, "Dashed", "Dark Green", "Target", 1 )}
),
Dispatch(
{},
"Oneway Plot",
FrameBox,
{Frame Size( 347, 229 ), DispatchSeg(
Box Plot Seg( 1 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 2 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 3 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 4 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 5 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 6 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 7 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 8 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 9 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 10 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 11 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 12 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 13 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 14 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 15 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 16 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 17 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 18 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
), DispatchSeg(
Box Plot Seg( 19 ),
{Box Type( "Outlier" ), Confidence Diamond( 0 ), Line Color( "Red" )
}
)}
),
Dispatch( {}, "Means and Std Deviations", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Means Comparisons", OutlineBox, {Close( 1 )} )
)
)));
Re: looping the process capability functionWhat is the code that is calling the CPK expression look like?Re: looping the process capability functionthanks for your patience, but even after chaging to n items it also only did the specs and histogram on one of the item in choices
the other one JMP still requested me for manual key in
CPK = Expr(
For( i = 1,i<=n items(choices) , i++,
Eval(
Substitute(
Expr(
Process Capability(
Process Variables( as column(choices[i])),
Spec Limits( __choices__( LSL( 400 ), Target( 425 ), USL( 450 ) ) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{ __choices__ << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config == "P1_31_PBO" )
)
),
Expr( __choices__ ), Parse( ":" || choices[i] )
)
)
)
);Re: looping the process capability functionI changed the For() loop definition when I was testing the code, and forgot to change it back......this is probably the issue.....please replace the For() loop with
CPK=expr(for(i=1,i<=n items(choices),i++,
Re: looping the process capability functiontweeted it slightly
but the specs and hidden histogram only work on the second item in the list do u know y?
CPK = Expr(
For( i = 1, i <= 2, i++,
Eval(
Substitute(
Expr(
Process Capability(
Process Variables( as column(choices[i])),
Spec Limits( __choices__( LSL( 400 ), Target( 425 ), USL( 450 ) ) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{ __choices__ << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config == "P1_31_PBO" )
)
),
Expr( __choices__ ), Parse( ":" || choices[i] )
)
)
)
);Re: looping the process capability functionSome statements in JSL do not have the ability to evaluate items in the statements prior to executing them. When that is found to be the case, using a Substitution to create the complete statement prior to running it works best. Below is a modification of your script to the substitution methodology.
CPK = Expr(
For( i = 1, i <= 1, i++,
Eval(
Substitute(
Expr(
Process Capability(
Process Variables( __choices__ ),
Spec Limits( __choices__( LSL( 400 ), Target( 425 ), USL( 450 ) ) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{ __choices__ << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config == "P1_31_PBO" )
)
),
Expr( __choices__ ), Parse( ":" || choices[i] )
)
)
)
);Re: looping the process capability functionthank you for the quick reply,
k is not linked to i
k is like the number of item of a group and i is the group
the as columns worked for the process variable but for spec limits and the closing of histogram it doesnt seem to work
/*****************************************************
*********************** Cpk *********************
*****************************************************/
CPK=expr(for(i=1,i<=n items(choices),i++,
Process Capability(
Process Variables(as column(choices[i]) ),
Spec Limits(
as column(choices[i])(LSL( 400 ),
Target( 425 ), USL( 450 ))
),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{as column(choices[i]) <<
Process Capability Analysis( Histogram( 0 ) )},
Where( :Config == "P1_31_PBO" )
);
));
Re: looping the process capability functionI believe your only syntax issue is that you need an As Column() function around the col_name[i].
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dt:sex << set name( "Config" );
dt:height << set property( "spec limits", {LSL( 55 ), USL( 70 ), Show Limits( 0 )} );
dt:weight << set property( "spec limits", {LSL( 80 ), USL( 160 ), Show Limits( 0 )} );
config = {"F", "M"};
col_name = dt << get column names( string, continuous );
cpk = Expr(
For( k = 1, k <= N Items( col_name ), k++,
Process Capability(
Process Variables( As Column( col_name[i] ) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
{choice[i] << Process Capability Analysis( Histogram( 0 ) )},
Where( :Config == config[k] )
)
)
);
For( i = 1, i <= N Items( col_name ), i++,
cpk
);
I am also a bit confused over your For Loop() using "k". Are you sure you want to loop through 1 through N Items( col_name ). It seems that col_name is being linked to the "i" variable?