Hello,
I'm trying to save the report window as PDF and HTML file but it's saving only half of them and during HTML file creation it's showing this error:
"There was an error writing the Web output file V:\User\User Reports\Beverly Jones\Yield Tracking\23Jul2015\Fill Yield (g\AdjAs L).htm.
Reason: Unable to open in ReadWrite mode.
The system cannot find the file specified."
Log Snapshot:
Code:
display=Function({Process,Label,By,Src_Type,lmt1,lmt2,lmt3},Current Data Table(dt);
summ_dt=dt<<Summary(Invisible,
Group(As Name(Process),As Name(Label),As Name(By))
);
srt_summ=summ_dt<<Sort(Invisible,By(As Name(Label)),Order(Ascending));Current Data Table(srt_summ);
r1=New Window("",
H List Box(
cc=Control Chart(
Sample Label(Column(srt_summ,Label)),
Group Size(1),KSigma(3),
As Column(srt_summ,Process),Individual Measurement(LCL(lmt1[6]),AVG(lmt1[5]),UCL(lmt1[7]))),
Where(As Column(By)==Src_Type);
);(Report(cc)<<Parent)[Text Box(1)]<<delete;rep=cc<<Report;ob=rep[OutlineBox(1)];ob<<Set Title("Paste Type"||" = "||Src_Type);
cc1=Control Chart(
Sample Label(Column(srt_summ,Label)),
Sample Size(1),
Alpha(0.00269979606326021),
Show Limits Legend(0),
As Column(srt_summ,Process),CUSUM(Two Sided(1),AVG(lmt2[5]))),
Where(As Column(By)==Src_Type);
);(Report(cc1)<<Parent)[Text Box(1)]<<delete;rep=cc1<<Report;ob=rep[OutlineBox(1)];ob<<Set Title("Paste Type"||" = "||Src_Type);
cc2=Control Chart(
Sample Label(Column(srt_summ,Label)),
Sample Size(1),
KSigma(3),Weight(0.2),
As Column(srt_summ,Process),EWMA(AVG(lmt3[5]))),
Where(As Column(By)==Src_Type);
);(Report(cc2)<<Parent)[Text Box(1)]<<delete;rep=cc2<<Report;ob=rep[OutlineBox(1)];ob<<Set Title("Paste Type"||" = "||Src_Type);
);
);vlb<<Append(r1);r1<<Close Window;
);
plot=Function({lmts,pmt_path,flg},
param_dt=Open(pmt_path,"invisible");
param_summ=param_dt<<Summary(Invisible,
Group(:Process,:Sample Label,:By))<<Show Window(0);
For(q=1,q<=NRow(param_summ),q++,Current Data Table(param_summ);
obj=New Window("Trend Analysis Report "||Long Date(Today()),
vlb=V list Box()
);
//obj<<Show Window(0);
col2=:Process[q];col3=:Sample Label[q];col4=:By[q];
Current Data Table(lmts);
clms=lmts<<Get Column Names(String);
Remove From(clms,1,3);
For(t=1,t<=N Items(clms),t++,Current Data Table(lmts);
indv_lmts=As Column(clms[t])[lmts<<Get Rows Where(:Parameter==col2 & :Chart Type=="Individual")];
cusum_lmts=As Column(clms[t])[lmts<<Get Rows Where(:Parameter==col2 & :Chart Type=="CUSUM")];
ewma_lmts=As Column(clms[t])[lmts<<Get Rows Where(:Parameter==col2 & :Chart Type=="EWMA")];
If(
OR(IsMissing(indv_lmts[5]),IsMissing(indv_lmts[6]),IsMissing(indv_lmts[7]),IsMissing(cusum_lmts[5]),IsMissing(ewma_lmts[5])),Continue(),
display(col2,col3,col4,clms[t],indv_lmts,cusum_lmts,ewma_lmts);
);
);
obj<<Set page setup(margins(1,1,1,1),scale(.75),portrait(0),paper size("Letter"));
If(
flg=="old",obj<<Save PDF(dir_path||col2||".pdf");obj<<Save Interactive HTML(dir_path||col2||".htm"),
flg=="new",obj<<Save PDF(sav_dir||col2||".pdf");obj<<Save Interactive HTML(dir_path||col2||".htm");
);
obj<<Close Window;
);
);
There are 12 iterations in total but it's saving the result of 6 only and interesting thing is that "obj" window is popping up for all of 12 iterations.
I'm not sure why exactly it's happening as the error above looks ambiguous as 6 iterations getting saved properly.
Any suggestion would be appreciated. Thanks!!