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

Parameter not working 1

Status
Not open for further replies.

maggielady

Technical User
Jan 3, 2003
60
US
I have a report that I want to be able to have the user chose a date range for the report. I have a field in the contrib table which is a recieved date. I want to create a parameter that will allow the user to chose a date range for the report. I've tried but can't get it to work. I put it in as a date and string and put the parameter in the report header but to no avail. Any suggestions?
 
When you say you cannot get it to work, what do you mean by that? Are you able to create the date range parameter? Are you getting an error message or just unexpected results?

Please elaborate.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
I tried to create the parameter, but apparently I didn't do it corectly, I don't get any error messages it's when I run the report it doesn't give me the date range I set up in the parameter. I set the parameter up like this:
value is date
options: range values
set default values: this is where I don't know what to put. I chose the dbf with the date recieved field and all the dates in that field are available. But I want the user to be able to choose any date range from 1995 to the present date and any future date. Not sure how to do this.

 
There is no requirement that you set default values. Just click OK at this point.

Did you ever get this far and actually try to run your report?

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
Right click the parameter and select edit->Default Values->Range Limited Field->Start Date = 1/1/1995 End Date = somethin waaaaaay in the future.

This will prevent the parameter from taking anything older than 1/1/1995.

Now select Report->Edit Selection Formula and place something like:

{yourtable.datefield} = {?YourParameter}

The report will prompt and limit the rows accordingly.

-k
 
Oooops:

"Now select Report->Edit Selection Formula and place something like:"

should be

"Now select Report->Edit Selection Formula->Record and place something like:"

 
yes, I put the parameter field in the report itself. I tried the edit selection formula but it said I needed a string here. Not sure why. I did just the setup without default settings and when I run the report I only get a place to select one date, not a date range. I'll play with it some more and see what happens. Thanks for all your help so far!!
 
Your date is probably bot a date field, rather a string.

Right click the field and select Browse Data to check it.

If it's a string, then create a formula which converts the date filed to a string and use that formula in the record selection formula.

It's a bit more complex, so get the particulars and post in the date format in the database, someone will straighten it out.

-k
 
yes, it is a string, and the format is yyyymmdd, can someone please give the instructions for converting this and putting it in a parameter field? Thanks alot!!! :)
 
Leave the parameter field as a date range.

Create 2 formulas (Insert->Field Object->Formulas->Right click->New):

@startdate
totext(minimum({?dateparameter}),"yyyyMMdd")

@enddate
totext(maximum({?dateparameter}),"yyyyMMdd")

Now in the record selection formula, use something like:

{table.datestringfield} >= @startdate
and
{table.datestringfield} <= @enddate

-k
 
When I go to Insert, I don't have a field object option?? I just don't seem to be getting this for some reason. I'll play with it somemore. Thanks for all the help, any more would be greatly appreciated!! Sorry for being so....not smart on this subject
 
What version of Crystal are you using?

Look under insert, parameter field.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
Version 9 , there is no insert parameter under insert?
 
In version 9 goto view, field explorer

Reebo
Scotland (Sunny with a Smile)
 
I created the two formulas above but when I try to put it in the selection formula, it tells me that there are too many arguments for this function: totext(maximum({?dateparameter}),&quot;yyyyMMdd&quot;)???? Any suggestions? I'm getting close to having this work/.
 
First of all, delete one parameter, it doesn't matter which.

Secondly, edit the remaining parameter, call it something logical like &quot;date range&quot;, and make sure it is a date range data type.

Third, write a record selection formula:
NumberToDate(Tonumber({YourStringField})) in {?DateRange})

You may have to download NumberToDate(), it is a UFL on the crystal decisions website. If you already have it, it will appear under &quot;additional functions&quot;. Here is the link:


If your field is a sting field in a YYYYMMDD format, then I guarantee you this will work.






Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
THANK you all for all the help, dgillz, it worked like a charm!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top