Avatar of rowfei
rowfei
 asked on

Date Parameter

What formula can I add to the date field, so end user can either select data via the calendar or the shortcut key such as T-1, M-1 etc???

Thanks in advance.
Crystal Reports

Avatar of undefined
Last Comment
Mike McCracken

8/22/2022 - Mon
peter57r

I appreciate this might just be me, but I have no idea what Crystal feature you are referring to by..
"the shortcut key such as T-1, M-1 etc"
Mike McCracken

There is no way to do that.  Crystal date prompts expect a date to be entered.  There are no shortcut keys to choose a date.

If you have CR2008 you can have optional prompts.  You could use a date for 1 and a string for another then evaluate appropriately.

I assume T-1 is yesterday and M-1 is last month

mlmcc
rowfei

ASKER
Yes, I do have CR2008. Do you have any sample for using the string?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
James0628

Do you just want to use those specific strings, "T-1" and "M-1"?  If so, what do they mean?

 Or do you want to allow something more general, like "T-X", where "X" could be different numbers?  If so, exactly what do you want to allow?

 Producing yesterday's date when a parameter is "T-1" is easy.  Actually checking the value after the "-" and producing a date based on that is more complicated.

 James
rowfei

ASKER
I would like to have:

T-"num" = today's day - num of days user enter.
T+"Num" = today's day + num of days user enter.

M-"num" = Current Month - num of month user enter.
M+"Num" = Current Month + num of month user enter.

Y-"num" = Current year - num of year user enter.
Y+"Num" = Current year + num of year user enter.

Also user should able enter what ever day they want on the beginning date and ending date field. Or select the date from the default calendar.

Thanks
Mike McCracken

As stated above, the only way to get the calendar is to use a DATE or DATETIME parameter.  It will only accept valid dates.

You can add a second parameter as a string and they can enter whatever they want.

I will try to get an example put together.

mlmcc
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
rowfei

ASKER
An example will be great. Thank you so much!!!
ASKER CERTIFIED SOLUTION
Mike McCracken

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question