Hi Guys,
I have this script that works 100% when I run it manually.
When I run it from the toolbar(automatically) it does not run the last section.
Do you have an idea of why this is happening?
I added a comment in the script in the point is not working anymore:
//STARTING FROM HERE THE SCRIPT DOES NOT RUN IN TOOLBAR MODE
//Script for GRR Anlaysis for Qual Data
names = {};
//prueba={};
RepeatabilityData = {};
ReproducibilityData = {};
GaugeRRData = {};
ParttoPartData = {};
NDCData = {};
Datos_table = Current Data Table();
For( i = 1, i <= N Col(), i++,
Insert Into( names, Column Name( i ) )
);
dlg1 = Dialog(
Title( "GR&R" ),
"Select Tests",
vlist( selectiontests = List Box( names ) ),
"Select Channel Column",
vlist( selectionchannel = List Box( names ) ),
"Select Category (Pre/Post) Column",
vlist( selectioncategory = List Box( names ) ),
"select Devices Number Column",
vlist( selectionSN = List Box( names ) ),
synch = Check Box( "Generate Journal", 0 ),
hlist( button( "OK" ), button( "Cancel" ) )
)
;
if (dlg1["Button"]==1,
column(dlg1["selectionchannel"])<<set modeling type("Nominal");
column(dlg1["selectioncategory"])<<set modeling type("Nominal");
column(dlg1["selectionSN"])<<set modeling type("Nominal");
Report= New Window("GRR Report",
For(i=1, i<=Nitems(dlg1["selectiontests"]),i++,
uno=Variability Chart(
Y(dlg1 ["selectiontests"][i]),
X(dlg1 ["selectionchannel"], dlg1["selectionSN"]),
Model (Crossed),
Historical Sigma (0),
Connect Cell Means (1),
Show Group Means (1),
Show Grand Mean (0),
Show Grand Median (1),
XBar Control Limits (0),
S control Limits (1),
Std Dev Chart (0),
Mean Plots (0),
Mean of Std Dev (1),
//Gauge RR (10,2),
//Gauge RR Report (0),
//)
//Journal Window;
);
dos=Variability Chart(
Y(dlg1 ["selectiontests"][i]),
X(dlg1 ["selectioncategory"], dlg1["selectionSN"]),
Model (Crossed),
Historical Sigma (0),
Variability Chart( 0 ),
Connect Cell Means (1),
Show Group Means (1),
Show Grand Mean (0),
Show Grand Median (1),
XBar Control Limits (0),
S control Limits (1),
Std Dev Chart (0),
Mean Plots (1),
Mean of Std Dev (1),
);
report(uno)[framebox(1)]<<frame size(978,150);
uno<<Show Grand Mean(1);
uno<<XBar Control Limits(1);
report(dos)[framebox(1)]<<frame size(186,150);
report(dos)[framebox(2)]<<frame size(300,150);
report(dos)[framebox(3)]<<frame size(300,150);
);
);
//GRR Analysis Data Table
TabWin=Datos_table << Tabulate(
Add Table(
Column Table(
Analysis Columns(
(dlg1["selectiontests"])
),
Grouping Columns(dlg1 ["selectioncategory"] ),
Statistics( Mean )
),
Row Table( Grouping Columns( :SN, Chan ) )
)
);
TabData = TabWin<< Make Into Data Table;
TabWin << Close Window;
TabData <<set name("GRR Analysis");
//*
//Section for Deltas in GRR analysis
CurrentDataTable(TabData);
ColNum=NCols();
For (j=3, j<=ColNum, j=j+2,
ColLen=Length(Char(Column name (j)));
ColName=Left (Char(Column Name(j)),ColLen -5);
NewCol=Substr(ColName,6);
TabData<<New Column(
"Delta: "||NewCol,
Numeric,
Formula(
(As Column((j))-As Column((j+1)))/As Column(j)
),
Format("Percent",5,2)
)
);
ColDelta=(ColNum-2)/2;
ColStart=4;
ListDelta = {};
For(k=1, k<=ColDelta, k++,
Insert Into(ListDelta, Column Name (Eval(ColNum+k)));
TabData << Move Selected Columns(
{Column (ColNum+k)}, after(Column(ColStart))
);
ColStart=ColStart+3;
);
//STARTING FROM HERE THE SCRIPT DOES NOT RUN IN TOOLBAR MODE
//Delta Variability
DeltaVar= New Window("GRR Delta Report",
For(l=1, l<=Nitems(ListDelta),l++,
//Col Std Dev(As Column(ListDelta[12]));
if(Col Std Dev(As Column(ListDelta[l]))>0.4,
ListDelta[l]<<set property ("Spec Limits",{LSL(-1 ), USL(1),Show Limits( 1 )})
);
if(Col Std Dev(As Column(ListDelta[l]))<0.4,
ListDelta[l]<<set property ("Spec Limits",{LSL(-0.1 ), USL( 0.1),Show Limits( 1 )})
);
if(Col Std Dev(As Column(ListDelta[l]))<0.001,
ListDelta[l]<<set property ("Spec Limits",{LSL(-0.01 ), USL( 0.01),Show Limits( 1 )})
);
tres=Variability Chart(
Y(ListDelta[l]),
X(:Chan, :SN),
Model (Crossed),
Historical Sigma (0),
Connect Cell Means (1),
Show Group Means (1),
Show Grand Mean (0),
Show Grand Median (1),
XBar Control Limits (1),
S control Limits (1),
Std Dev Chart (0),
Mean Plots (0),
Mean of Std Dev (1),
//Gauge RR (10,2),
//Gauge RR Report (0),
);
//report(tres)[FrameBox(1)]<<frame size(978,150);
//tres<<Show Grand Mean(1);
//tres<<XBar Control Limits(1);
);
);
);