Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula as Parameter to COMMAND for Report for Month Date Range

Status
Not open for further replies.

Statey603

Programmer
Nov 10, 2009
196
US
I have a report that needs to be run for a complete month. As part of the requirement, I cannot rely on the user to enter a valid date range. Therefore, I am thinking of using a dropdown parameter where the user will select a month and then a numeric parameter for the user to specify a year. I have formulas and shared variables to get the determine the actual date range.
For example: [May 1, 2014 - May 31, 2014]
[Jun 1, 2013 - Jun 30, 2013]
Is there a way to pass these formula result variable values to my main COMMAND to be used in my WHERE clause ?

I appreciate any assistance with how to accomplish this and/or any suggestions on alternate ways to achieve a report that executes for a single month date range specified by the user as described above.

Thanks
 
I came up with a solution to this in case anyone else runs into a similar situation.

I created a new, blank report.
I inserted my original report as a sub-report in the detail section of the main report and suppressed all of the main report sections except for the detail section.

I added the needed input Parameters (described in original post) to the main report.
- Month dropdown list
- Year
- Vendor #
I took the formulas that determine the Start and End Dates [from month/year params] out of the subreport and put them in my main report.
I joined the subreport and the main report [via subreport links] as follows:
Main report formula getBgnDate linked to subreport RptBgnDate parameter
Main report formula getEndDate linked to subreport RptendDate parameter
Main report parameter Vendor # linked to subreport Vendor # parameter
The subreport uses the parameters in its COMMAND.

 
You can pass the parameters for month and year to the command and calculate the month dates in the SQL statement

Viewer and Scheduler for Crystal reports, SSRS and Dynamic Dashboards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top