Initializing Parameters
Hi
RBEnt 11.08
I am wanting to initialize a parameter used in an autosearch. I have tried
both of the following but neither is working.
procedure ReportOnInitializeParameters(var aCancel: Boolean);
begin
Report.Parameters['ShiftDate'] := CurrentDate;
aCancel := false;
end;
procedure ReportBeforeAutoSearchDialogCreate;
begin
Report.AutoSearchCriteriaByName('Shift','ShiftDate').SearchExpression :=
DateToStr(currentdate);
end;
Any suggestions?
Regards
Tim Murfitt
RBEnt 11.08
I am wanting to initialize a parameter used in an autosearch. I have tried
both of the following but neither is working.
procedure ReportOnInitializeParameters(var aCancel: Boolean);
begin
Report.Parameters['ShiftDate'] := CurrentDate;
aCancel := false;
end;
procedure ReportBeforeAutoSearchDialogCreate;
begin
Report.AutoSearchCriteriaByName('Shift','ShiftDate').SearchExpression :=
DateToStr(currentdate);
end;
Any suggestions?
Regards
Tim Murfitt
This discussion has been closed.
Comments
In my testing, using code identical to the code you have below in the
OnInitializeParameters event, the autosearch value properly reflects the new
parameter value assigned.
Be sure you have the AutoSearchSettings of the parameter enabled and that
you are linking the parameter to the autosearch field in DADE.
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
enhanced to be read/write. Try using
Report.Parameters.Items['ParameterName'] to access the TppParameter object
and set its Value property.
myReport.Parameters.Items['ShiftDate'].Value := CurrentDate;
Also keep in mind that you need to define the Report.Parameters[ ] in the
report layout workspace and then bind the query to the parameter item.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I have checked and checked but can not get it to work correctly. I have gone
back to a DBDemos data set and used just one string parameter as a test. I
can see that the event is firing ok and i used ShowMessage in the event to
try and display the value I had just set but it keeps coming back blank.
I will email you the sample report i have used for testing.
Tim
Thanks for that. Now all sorted.
Regards
Tim