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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter generated Formula question 1

Status
Not open for further replies.

dddivers

Instructor
Dec 4, 2001
30
US

Hi, I have a report in Crystal 9 that I'd like to make as easy as possible for users to query all sales from full previous month. They don't know how to create or use formulas via the Select Expert so I've been trying to tie a FullPreviousMonth function (based on a SalesDate field) to a Parameter prompt. Can't get it to work though.

Wish Crystal had command buttons that users could simply click to run the macro that would pull all sales from previous month (like I can do in Excel or Access).

Any ideas? THANK YOU!
 
If they always want to see the last full month, then why do you need a parameter? You could use a record selection formula:

{table.salesdate} in lastfullmonth

If you want this to be only one of several options, you could create a string parameter {?daterange} with default options like "Last Full Month", "Last Full Week", "Yesterday". Then create a record selection formula like:

if {?daterange} = "Last Full Month" then
{table.salesdate} in lastfullmonth else
if {?daterange} = "Last Full Week" then
{table.salesdate} in lastfullweek else
if {?daterange} = "Yesterday" then
{table.salesdate} = currentdate -1

-LB
 
So beautiful. Works perfectly. Where I was stumbling was thinking that my record selection formula had to be tied directly to the parameter's name and trying to incorporate a similar formula to yours as part of the tie. I also was having a hard time reconciling the Parameter on a date field assigned as a string data type.

I can't thank you enough. Best wishes - dddivers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top