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

Data Parameter Field in Title and Generate in Formula.

Status
Not open for further replies.

Linn

Programmer
Mar 11, 2002
1
US
Hello, I have a basic report that I am generating from 4 linked tables. I want to be prompted for a BEGINNING DATE and ENDING DATE. The dates I enter at the parameter prompts fill in the date blanks in the Title, but I need them to automatically update my formula to capture the range of data I need. The Title gets updated properly, but formula dates don't.

By the sample below, can you tell me what I am doing incorrectly, or give me some tips on how I can do this easily? Thanks so much, Linn. :)


TITLE:TASK CHECK REPORT
COVERING ?begin THROUGH ?ending

{HRS.OFFICE} = 'W' and
{HRS.TASK}='FRB' and
({HRS.WEEKENDING} >= Date (?begin) and
{HRS.WEEKENDING} <= Date (?ending))
 
Change your 2 date parameter fields to one date parameter field, and make it a range valued field. Make the appropriate change in your recoprd selection formula and your title formula would be:

ToText(Minimum({?RateRangeParm}))+&quot; to &quot;+totext(maximum({?DateRangeParm})) Software Support for Macola, Crystal Reports and Goldmine
dgillz@juno.com
 
if you are using a newer version of crystal, you can set your parameter as a date range, once you do that just set your record selection formula as:
{?parameterdates}= {HRS.WEEKENDING}
to display the beginning and ending range values in the report use the following formulas:
minimum({?parameterdates})
to show the start date
and maximum({?parameterdates})
to show the end date
Cheers,
-Bruce Seagate Certified RCAD Specialist.
-Bruce Thuel-Chassaigne
roadkill150@hotmail.com
 
Why use a date range? IMHO it introduces potential problems.
1) The user needs to make sure that 12-20 characters are entered correctly rather than 6-10 characters.
2) In coding the &quot;ToText&quot; statement, one must keep track of all the parents.
3) The use of &quot;Min&quot; & &quot;Max&quot; rather than explicit date params is clumsy and complicates coding.
4) It increases the amount of code.

Obviously, I use ?starting & ?ending.

Linn - Is the following code from the Show SQL Query or from the SelectExpert?
{HRS.OFFICE} = 'W' and
{HRS.TASK}='FRB' and
({HRS.WEEKENDING} >= Date (?begin) and
{HRS.WEEKENDING} <= Date (?ending))

In SelectExpert I use:
TransDate in ?starting to ?ending

 
LINN

Your approach is perfectly fine.

Your problem is in the conversion of the string value of your date to a date itself.

You have not shown us the format of {?Begin} or {?End}

if it is like 20020128 (format: yyyymmdd) then it needs to be converted to a date using

Date(ToNumber(left({?Begin},4)),
ToNumber(Mid({?Begin},5,2)),
ToNumber(Right({?Begin},2)))

I understand the desire to have the date entered as a string...it is easier on the user...especially when the report is web enabled where (at least for CR 8.0) calendar dropdowns are not allowed

hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top