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!

Converting parameter output to text 3

Status
Not open for further replies.

jstepsfs

Programmer
Jul 21, 2011
6
US
I'm creating a series of linked reports (one main report with multiple subreports) and am using a 'Range Value' parameter to input the date range. That all works fine...one parameter determines the date for three bar charts and another determines the date for a pie chart. All pretty basic. What I now want to do is have text at the top of the report that reflects the dates that I've input into the parameter.

ie: I create a bar graph with the dates that I entered, and I want those dates to show up in the header...something like "Date Range: Thursday, June 1, 2010 to Thursday, June 30, 2011"

I'm not sure if I'm stating this right, so I hope it conveys what I mean. I am using CR 9.2.

Thanks in advance for any and all help.
 
jstepsfs,

Do you have one parameter with a range, or 2 parameters (a startdate and enddate)?

I haven't done this for range prompts, but the syntax is as follows if 2 separate parameters. Create in a formula field:
Code:
"Date Range: " & ToText({?YourStartParameter},"dddd, MMM d, yyyy") & " to " ToText({?YourEndParameter},"dddd, MMM d, yyyy")

Alternately, perhaps a Min() and Max() of the database field the paramter references ycould also be substituted. Something like:
Code:
"Date Range: " & ToText(Minimum({YourDateField}),"dddd, MMM d, yyyy") & " to " ToText(Maximum({YourDateField}),"dddd, MMM d, yyyy")

Hope this helps!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
jstepsfs,

I don't have Crystal in front of me or I'd test this for you... but perhaps combine the above ideas and do a Min() and Max() of the Parameter field?

Cheers!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Whenever I create a date range parameter, I also create a start date formula and an end date formula for display purposes.

The start date formula code would be...
minimum({?Your_Date_Range_Parameter})

...and the end date formula code would be...
maximum({?Your_Date_Range_Parameter})

You can place the start and end date formulas on the report and use the normal date formatting options to make them appear as you wish.

You can also drag the formulas into text objects to get the heading you were looking for.

Steve Phillips, Crystal Reports Trainer & Consultant
 
Thanks Steve,

I hadn't done Minimum & Maximum on a Parameter to know if it took the min and max value the report returns, or if it took the Min and Max amounts keyed into the parameter.

Excellent!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
WOW! Thanks for all the response guys! Sorry for my lack of response...I've been away from work for a few days. I will be testing this out today and will let you know how it works out.

Thanks again!!!
 
Thanks again guys. The first formula that Mike posted worked like a charm.

Oddly, I get an error when I try to create a formula with 'minimum({?StartDateParameter})'. When I try to save it Crystal returns with a "This field cannot be summarized" error. I am not sure what I'm doing wrong...I suppose it could be the fact that I'm using an older version (9.2)?

Regardless, I have what I need to make my report work. Thank you both again for your help. I really love this forum!!
 
jstepsfs,

I would *think* this error is a result of having 2x parameters (one for Start Date and a second for End Date). If you had one parameter field that allowed a range, I think then the Minimum() and Maximum() functions would work. I would have to test to confirm this though.

Glad you found what you sought. Cheers!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Date Range: "+ totext({?StartDate},"dddd, MMMM d, yyyy")+" to "+ totext({?EndDate},"dddd, MMMM d, yyyy")

There is also an faq767-5684 on how to display parameter results.

-LB
 
Thanks Mike. :) I'll test that theory out and let you know.

Thanks for the formula, and the link. I'll check the FAQ for more helpful info. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top