Application variable access and Grouping
Two questions:
I'd like to use the value contained in two main form edit fields in a
report title. i.e. "Report period: editFrom - editTo". What's the
easiest way to get at those component values from within the report?
Is there a way to group on a value derived from a function or a
sub-string of a data field? i.e. the table contains a DatePaid field and
I need the report to group on the YEAR of that date.
This seems like really basic stuff, but after pouring over the RB dev
guide and tutorials for a couple of hours, I just can't seem to find it.
Sorry...
Thanks for any help.
I'd like to use the value contained in two main form edit fields in a
report title. i.e. "Report period: editFrom - editTo". What's the
easiest way to get at those component values from within the report?
Is there a way to group on a value derived from a function or a
sub-string of a data field? i.e. the table contains a DatePaid field and
I need the report to group on the YEAR of that date.
This seems like really basic stuff, but after pouring over the RB dev
guide and tutorials for a couple of hours, I just can't seem to find it.
Sorry...
Thanks for any help.
This discussion has been closed.
Comments
1. Depending on how your application is designed, you could simply
assign the Caption property of a couple labels in your report directly
in Delphi before the report is printed.
ppLabel1.Caption := EditFrom.Text;
ppLabel2.Caption := EditTo.Text;
If you do not have access to the report components from Delphi (i.e. you
are loading templates), you can pass the values as TppParameters, then
use the parameter values later in RAP code if needed. See the
TppReport.Parameters help topic and the parameters RBWiki article for
more information.
http://www.digital-metaphors.com/rbWiki/End-User/Fundamentals/Report_Parameter_Fundamentals
2. The easiest way to group on the year would be to create a calculated
field that extracts the year. Most modern databases support something
like the DatePart() (SQL Server) or Extract() (Oracle) routine. Once
you've separated out the year, you could simply sort on that field and
create a year group.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com