Re: Xdialog Cancel Button
Sorry about that.
I have modified the code to stop on cancel.
You need to define the variables in the report. I made them GLOBAL in the script. This means that you need to make them Global in the report. The script runs as advertised...now.
Script:
Attached are the PDF of the report as well as a snapshot of the Variable definition.
Have fun...
Tom
Sorry about that.
I have modified the code to stop on cancel.
You need to define the variables in the report. I made them GLOBAL in the script. This means that you need to make them Global in the report. The script runs as advertised...now.
Script:
Code:
'Create an XDialog dialog box to prompt for parameters. DIM SHARED DateBegin as D DIM SHARED DateEnd as D DIM SHARED varC_result as C heading_string = "Enter Date Range of Report" ok_button_label = "&OK" cancel_button_label = "&Cancel" varC_result = ui_dlg_box("Customer Contact Report",<<%dlg% {region} {text=30,1:heading_string}; {endregion}; {region} Beginning Date:| [%DATE;P=popup.calendar(dtoc(DateBegin));I=popup.calendar%.15DateBegin!DateBegin_*]; Ending Date:| [%DATE;P=popup.calendar(dtoc(DateEnd));I=popup.calendar%.15DateEnd!DateEnd_*]; {endregion}; {line=1,0}; {region} <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL> {endregion}; %dlg%,<<%code% if left(a_dlg_button,10) = "DateBegin_" then if a_dlg_button = "DateBegin_killfocus" then DateBegin = ctod(dtoc(DateBegin)) end if a_dlg_button = "" end if if left(a_dlg_button,8) = "DateEnd_" then if a_dlg_button = "DateEnd_killfocus" then DateEnd = ctod(dtoc(DateEnd)) end if a_dlg_button = "" end if %code%) if varC_Result <>"OK" ui_msg_box("Customer Reports","Action Cancelled at user request") end end if dim cnt as N cnt = a5_get_records_in_query("customer",between_date("Contact_date",var->datebegin,var->dateend)) IF cnt=0 ui_msg_box("Customer Report","No Customers match dates in the range of "+dtoc(var->datebegin)+" to "+dtoc(var->dateend)) END 'DO NOT PRINT THE REPORT ELSE 'Preview a report, label, letter, form or browse layout. You can specify which records to preview. query.filter = "between(Contact_date,Var->DateBegin,Var->DateEnd)" query.order = "recno()" 'replace variables in the filter with their actual values query.filter = convert_expression(query.filter,"V") :Report.Preview("Customer Report",query.filter,query.order) END IF END
Have fun...
Tom
Comment