To All:
I'm a heavy-duty script guy jerking over from A4. As such, I've built a system to print reports and need to know if my methods are going to get me into trouble. This particular method works fine in my own app but I'm not good at all the code stuff and need reasurances. Below is what I have set up to make and print reports.
At Menu Init I dim globals - 10 of them used thruout the system. Among these are 'Report'and 'Begin'and 'Endo'[start and ending dates]. All reports are explicitly filtered - like we used to do in A4. I don't have to run queries. Report Detail Properties are filled in for sort order and filter and 'Current selection of records' is checked. When I need a button for report print I just set up a start below
**FORM BUTTON
'This sets global var->report for Print1 script
Report="Sales Condensed"
'This plays "What Date"- not 'dialog' method - which sets date
'parameters and calls "print1" script
script_play("WdateC")
=======================================
SCRIPT -'WDateC'
'loads and centers the Dialog form
p_frm = :Form.load("What Date")
ml = (ui_info(2)-p_frm.width)/2
p_frm.left = :A5.left+ml
p_frm.top = :A5.top+175
p_frm.activate()
p_frm.show()
**OK Button on the dates form action**
if isblank("var->begin").or.isblank("var->endo")then
ui_msg_box("Whoops","Please enter a value in both"+chr(10)+"Starting and ending Dates"+chr(10)+"Or you'll be sorry")'never mind the sorry stuff
end
end if
if val(cdate(endo))report' already set on the starting form button
''XBasic
dim A_ASK_PRINT as c
A_ASK_PRINT = ui_get_radio(this.text, 1, "Preview", "Print")
if A_ASK_PRINT = "Preview"
goto preview
elseif A_ASK_PRINT = "Print"
goto print
else
goto cleanup
end if
preview:
:Report.preview(var->Report,db_filter_get(db_current()),db_order_get(db_current()))
goto cleanup
print:
:Report.print(var-report,db_filter_get(db_current()),db_order_get(db_current()))
goto cleanup
cleanup:
end
============================
This is all handy because all I have to do for the form button is two lines - set the variable 'report', and a line to play the print1 script.
Am I going to get in trouble if I network this method on a sold app?
Ken
I'm a heavy-duty script guy jerking over from A4. As such, I've built a system to print reports and need to know if my methods are going to get me into trouble. This particular method works fine in my own app but I'm not good at all the code stuff and need reasurances. Below is what I have set up to make and print reports.
At Menu Init I dim globals - 10 of them used thruout the system. Among these are 'Report'and 'Begin'and 'Endo'[start and ending dates]. All reports are explicitly filtered - like we used to do in A4. I don't have to run queries. Report Detail Properties are filled in for sort order and filter and 'Current selection of records' is checked. When I need a button for report print I just set up a start below
**FORM BUTTON
'This sets global var->report for Print1 script
Report="Sales Condensed"
'This plays "What Date"- not 'dialog' method - which sets date
'parameters and calls "print1" script
script_play("WdateC")
=======================================
SCRIPT -'WDateC'
'loads and centers the Dialog form
p_frm = :Form.load("What Date")
ml = (ui_info(2)-p_frm.width)/2
p_frm.left = :A5.left+ml
p_frm.top = :A5.top+175
p_frm.activate()
p_frm.show()
**OK Button on the dates form action**
if isblank("var->begin").or.isblank("var->endo")then
ui_msg_box("Whoops","Please enter a value in both"+chr(10)+"Starting and ending Dates"+chr(10)+"Or you'll be sorry")'never mind the sorry stuff
end
end if
if val(cdate(endo))report' already set on the starting form button
''XBasic
dim A_ASK_PRINT as c
A_ASK_PRINT = ui_get_radio(this.text, 1, "Preview", "Print")
if A_ASK_PRINT = "Preview"
goto preview
elseif A_ASK_PRINT = "Print"
goto print
else
goto cleanup
end if
preview:
:Report.preview(var->Report,db_filter_get(db_current()),db_order_get(db_current()))
goto cleanup
print:
:Report.print(var-report,db_filter_get(db_current()),db_order_get(db_current()))
goto cleanup
cleanup:
end
============================
This is all handy because all I have to do for the form button is two lines - set the variable 'report', and a line to play the print1 script.
Am I going to get in trouble if I network this method on a sold app?
Ken