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

Date Parameter Using a Range selection or a Date Range 2

Status
Not open for further replies.

Jcfx

MIS
Oct 8, 2004
134
0
0
US
Greetings,

Using Crystal Report 11, SQL 2005 database.

This older thread here:
Has exactly what I needed, and it works.. almost. If I comment out the 'Specified Range' the period ranges perform perfectly. If I don't comment out the last line of the formula and choose one of the period range criteria, it will not let me choose 'ok' leaving the date range field blank. It is still expecting me to fill in specified range information. If I choose specified range and fill in the date information it performs normally.

So in summary:
Choose Year To Date, still expecting me to enter date range and will not allow the prompt to close.
Choose Specified Range, fill in Date data works fine.
Remove Specified range from formula, Choose Year To Date, works perfectly.

Here are my formulas:

Code:
//Record Selection
{v_rpt_InvoicedRepairs.CUSTID} like {?Customer ID} and
(
select {?RangeType}
case "Life To Date" : {v_rpt_InvoicedRepairs.CLOSED} in AllDatesToToday
case "Year To Date" : {v_rpt_InvoicedRepairs.CLOSED} in YearToDate
case "Specified Range" : {v_rpt_InvoicedRepairs.CLOSED} = {?DateRange}
)

Parameters:
?RangeType
Type:String
Value:
Life To Date
Year To Date
Specified Range

Options:
Allow custom values True
Allow multiple values False
Allow discrete values True
Allow range values False

?DateRange
Type:date time
value:v_rpt_InvoicedRepairs.CLOSED
Options:
Allow Multiple Values false
allow discrete values false
allow range values true

Thank you for any assistance,







Julie
CRXI CE10 / RS2005 Sql DB
 
Hi,
I am not sure why there is a 'value' in the ?RangeDate parameter. Try removing it and see if it makes any difference in behavior.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Unless I am mistaken, that formula allows the report to ignore the Date Range parameter values. But unfortunately, v11 still doesn't allow you to skip a parameter. So your method would still require you to put in something for the date range and CR would ignore it. ALL parameters are required in v11 so you still have to touch it. And in v11 you can't leave it at the default, because unlike previous versions, there is no default of today's date. I haven't tested it but I am not even sure that setting a default for the date will get you past this.

I do know that if you upgrade to v12 (CR 2008) you can have optional parameters which can be skipped and you can code for what to do when the user skips the parameter.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
I think you have to enter a value in the parameter or at least add a default value. Then when "Selected Range" is NOT selected, the default value will meet the requirement that the parameter have a value--but the value will have no effect on record selection.

-LB
 
Thank you everyone for your replies, I apologize for not getting back earlier, had to replace someone else on an out of town trip.

Entering the date parameter worked. Though it's awkward. I appreciate all of your assistance

Julie
CRXI CE10 / RS2005 Sql DB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top