Business Automation and Software Blog

Business Reporting: Passing date parameters into a sub report

Posted by Robert Baran on Wed, Jan 26, 2011 @ 03:10 PM

business-reportingUsing Business Objects (Crystal Reports) for business reporting, we often run into the situation where a sub report is required that is based on the parameters requested in the main report. There may not be a direct link from a data element in the main report and data sub report. This seems to occur most often when the sub report is in the report footer. For example a check register is created that is selected by check date range. A summary report is required after the checks are printed to show the total expenses by general ledger account paid for by these checks.

I have tried to pass local, shared and global variables into the sub report. It does not work for the record selection. What we have found is that the sub report links either from the sub report wizard or the sub report links will work. It would have been better if instead of being called links the wizard referred to them as restrictions.

To pass the dates into the sub report using the check register example above:

1. Create 2 parameters, From Date and To Date in the main report.

2. Create a sub report with the date field to restrict on.

3. Edit the Sub report Links and add each of the date parameters from the main report to the list of linked fields to the sub report. "Link" to the date you wish to restrict against.

4. Edit the sub report,

Edit the selection formula for Records changing the ‘=’ to ‘>=’ and ‘<=’.

For Example:

The formula will appear like this:

{APHDRH.TransactionDate} = {?Pm-@int start date} and

{APHDRH.TransactionDate} = {?Pm-@int end date}

5. Change the formula to:

{ APHDRH.TransactionDate } >= {?Pm-@int start date} and

{ APHDRH.TransactionDate } <= {?Pm-@int end date}

 

If you'd like more information on how you can get the best business reporting out of your system, or would like to speak with one of our computer consultants, please contact PositiveVision today for a complimentary 1 hour reporting consultation.

Contact PositiveVision ► ► for a Complimentary  Reporting Consultation

Topics: Business Reporting, crystal reports