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!

Using a formula as a report parameter

Status
Not open for further replies.

zeugma1

IS-IT--Management
Nov 7, 2001
7
GB
I want to create a report which allows the user to select either the current year or previous year, so the default parameters are year(currentdate) and year(currentdate)-1. But I can't do this - or can I?
 
The default values would be the literal values "Current Year" and "Previous Year". Then conditionally set your record selection formulas bases on these values. For example:

if {?Parameter}="CurrentYear" then {InvoiceDate} in YeartoDate else {InvoiceDate} in dateadd("y",-1,minimum(YearToDate)) to date(Year(CurrentDate)-1,12,31)

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
That's what I'm doing at the moment - but I want to present the user with the choices 2003 and 2002, or whatever the current and previous year happen to be when the report is run.
 
Unfortunately, you have to use external code to dynamically update a parameters value, or a third party viewer.

As dgillz meantioned, change the prompt to literally state "Current Year and Previous Year, and then let the record selection formula (report->Edit selection formula->record) determine which years they are using a formula akin to his.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top