I have a table and want to produce reports that:
1) filter on either type = "BGA" or Type = "TRI"
2) a choice of PDF , Preview or Print.
3) a choice of 1, 2 or 3 columns per report page.
In my usual trial-and-error way I came up with the following.
It works but looks horrendously complicated.
My question, is there a simple way of doing this ?
thx
DELETE a_prtfunction
temp_list = <<%list%
BGA^PDF^1Col
BGA^PDF^2Col
BGA^PDF^3Col
BGA^Preview^1Col
BGA^Preview^2Col
BGA^Preview^3Col
BGA^Print^1Col
BGA^Print^2Col
BGA^Print^3Col
Trigraph^PDF^1Col
Trigraph^PDF^2Col
Trigraph^PDF^3Col
Trigraph^Preview^1Col
Trigraph^Preview^2Col
Trigraph^Preview^3Col
Trigraph^Print^1Col
Trigraph^Print^2Col
Trigraph^Print^3Col
%list%
lc = w_count(temp_list,crlf())
DIM a_prtfunction[lc] as c
a_prtfunction.initialize(temp_list)
prt_dlg_title = "Print Dialog"
varC_result = ui_dlg_box(Prt_Dlg_Title,<<%dlg%
{region}
Print Options:| [%S=BLR;D="^"%.28,5prtfunction^<a_prtfunction];
{endregion};
{line=1,0};
{region}
<*15Create!CREATE><15Close!CLOSE>
{endregion};
%dlg%,<<%code%
if a_dlg_button = "CLOSE"
ui_modeless_dlg_close(prt_dlg_title)
a_dlg_button = ""
end if
if a_dlg_button = "CREATE" then
trace.writeln(prtFunction)
select
' 1Col
' Trigraph
case prtfunction = "Trigraph^PDF^1Col"
:Report.SaveAs("missing_extr_report_1col","PDF","Type='TRI'","",filename_decode("[Report]Tri_pdf1Col.pdf"),.T.)
case prtfunction = "Trigraph^Preview^1Col"
:Report.Preview("missing_extr_report_1col","Type='TRI'","",.t.,.t.)
case prtfunction = "Trigraph^Print^1Col"
:Report.Print("missing_extr_report_1col","Type='TRI'","")
' Bga
case prtFunction = "BGA^PDF^1Col"
:Report.SaveAs("missing_extr_report_1col","PDF","Type='BGA'","",filename_decode("[Report]BGA_pdf1Col.pdf"),.T.)
case prtfunction = "BGA^Preview^1Col"
:Report.Preview("missing_extr_report_1col","Type='BGA'","",.t.,.t.)
case prtfunction = "BGA^Print^1Col"
:Report.Print("missing_extr_report_1col","Type='BGA'","")
' 2Cols
' Trigraph
case prtfunction = "Trigraph^PDF^2Col"
:Report.SaveAs("missing_extr_report_2col","PDF","Type='TRI'","",filename_decode("[Report]Tri_pdf2Col.pdf"),.T.)
case prtfunction = "Trigraph^Preview^2Col"
:Report.Preview("missing_extr_report_2col","Type='TRI'","",.t.,.t.)
case prtfunction = "Trigraph^Print^2Col"
:Report.Print("missing_extr_report_2col","Type='TRI'","")
' BGA
case prtFunction = "BGA^PDF^2Col"
:Report.SaveAs("missing_extr_report_2col","PDF","Type='BGA'","",filename_decode("[Report]BGA_pdf2Col.pdf"),.T.)
case prtfunction = "BGA^Preview^2Col"
:Report.Preview("missing_extr_report_2col","Type='BGA'","",.t.,.t.)
case prtfunction = "BGA^Print^2Col"
:Report.Print("missing_extr_report_2col","Type='BGA'","")
'3Cols
' Trigraph
case prtfunction = "Trigraph^PDF^3Col"
:Report.SaveAs("missing_extr_report_3col","PDF","Type='TRI'","",filename_decode("[Report]Tri_pdf3Col.pdf"),.T.)
case prtfunction = "Trigraph^Preview^3Col"
:Report.Preview("missing_extr_report_3col","Type='TRI'","",.t.,.t.)
case prtfunction = "Trigraph^Print^3Col"
:Report.Print("missing_extr_report_3col","Type='TRI'","")
' Bga
case prtFunction = "BGA^PDF^3Col"
:Report.SaveAs("missing_extr_report_3col","PDF","Type='BGA'","",filename_decode("[Report]BGA_pdf3Col.pdf"),.T.)
case prtfunction = "BGA^Preview^3Col"
:Report.Preview("missing_extr_report_3col","Type='BGA'","",.t.,.t.)
case prtfunction = "BGA^Print^3Col"
:Report.Print("missing_extr_report_3col","Type='BGA'","")
end select
a_dlg_button = ""
end if
%code%)
1) filter on either type = "BGA" or Type = "TRI"
2) a choice of PDF , Preview or Print.
3) a choice of 1, 2 or 3 columns per report page.
In my usual trial-and-error way I came up with the following.
It works but looks horrendously complicated.
My question, is there a simple way of doing this ?
thx
DELETE a_prtfunction
temp_list = <<%list%
BGA^PDF^1Col
BGA^PDF^2Col
BGA^PDF^3Col
BGA^Preview^1Col
BGA^Preview^2Col
BGA^Preview^3Col
BGA^Print^1Col
BGA^Print^2Col
BGA^Print^3Col
Trigraph^PDF^1Col
Trigraph^PDF^2Col
Trigraph^PDF^3Col
Trigraph^Preview^1Col
Trigraph^Preview^2Col
Trigraph^Preview^3Col
Trigraph^Print^1Col
Trigraph^Print^2Col
Trigraph^Print^3Col
%list%
lc = w_count(temp_list,crlf())
DIM a_prtfunction[lc] as c
a_prtfunction.initialize(temp_list)
prt_dlg_title = "Print Dialog"
varC_result = ui_dlg_box(Prt_Dlg_Title,<<%dlg%
{region}
Print Options:| [%S=BLR;D="^"%.28,5prtfunction^<a_prtfunction];
{endregion};
{line=1,0};
{region}
<*15Create!CREATE><15Close!CLOSE>
{endregion};
%dlg%,<<%code%
if a_dlg_button = "CLOSE"
ui_modeless_dlg_close(prt_dlg_title)
a_dlg_button = ""
end if
if a_dlg_button = "CREATE" then
trace.writeln(prtFunction)
select
' 1Col
' Trigraph
case prtfunction = "Trigraph^PDF^1Col"
:Report.SaveAs("missing_extr_report_1col","PDF","Type='TRI'","",filename_decode("[Report]Tri_pdf1Col.pdf"),.T.)
case prtfunction = "Trigraph^Preview^1Col"
:Report.Preview("missing_extr_report_1col","Type='TRI'","",.t.,.t.)
case prtfunction = "Trigraph^Print^1Col"
:Report.Print("missing_extr_report_1col","Type='TRI'","")
' Bga
case prtFunction = "BGA^PDF^1Col"
:Report.SaveAs("missing_extr_report_1col","PDF","Type='BGA'","",filename_decode("[Report]BGA_pdf1Col.pdf"),.T.)
case prtfunction = "BGA^Preview^1Col"
:Report.Preview("missing_extr_report_1col","Type='BGA'","",.t.,.t.)
case prtfunction = "BGA^Print^1Col"
:Report.Print("missing_extr_report_1col","Type='BGA'","")
' 2Cols
' Trigraph
case prtfunction = "Trigraph^PDF^2Col"
:Report.SaveAs("missing_extr_report_2col","PDF","Type='TRI'","",filename_decode("[Report]Tri_pdf2Col.pdf"),.T.)
case prtfunction = "Trigraph^Preview^2Col"
:Report.Preview("missing_extr_report_2col","Type='TRI'","",.t.,.t.)
case prtfunction = "Trigraph^Print^2Col"
:Report.Print("missing_extr_report_2col","Type='TRI'","")
' BGA
case prtFunction = "BGA^PDF^2Col"
:Report.SaveAs("missing_extr_report_2col","PDF","Type='BGA'","",filename_decode("[Report]BGA_pdf2Col.pdf"),.T.)
case prtfunction = "BGA^Preview^2Col"
:Report.Preview("missing_extr_report_2col","Type='BGA'","",.t.,.t.)
case prtfunction = "BGA^Print^2Col"
:Report.Print("missing_extr_report_2col","Type='BGA'","")
'3Cols
' Trigraph
case prtfunction = "Trigraph^PDF^3Col"
:Report.SaveAs("missing_extr_report_3col","PDF","Type='TRI'","",filename_decode("[Report]Tri_pdf3Col.pdf"),.T.)
case prtfunction = "Trigraph^Preview^3Col"
:Report.Preview("missing_extr_report_3col","Type='TRI'","",.t.,.t.)
case prtfunction = "Trigraph^Print^3Col"
:Report.Print("missing_extr_report_3col","Type='TRI'","")
' Bga
case prtFunction = "BGA^PDF^3Col"
:Report.SaveAs("missing_extr_report_3col","PDF","Type='BGA'","",filename_decode("[Report]BGA_pdf3Col.pdf"),.T.)
case prtfunction = "BGA^Preview^3Col"
:Report.Preview("missing_extr_report_3col","Type='BGA'","",.t.,.t.)
case prtfunction = "BGA^Print^3Col"
:Report.Print("missing_extr_report_3col","Type='BGA'","")
end select
a_dlg_button = ""
end if
%code%)
Comment