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

Newbie question re date ranges 1

Status
Not open for further replies.

jahistx

Technical User
Jun 21, 2002
94
GB
Hi

Crystal reports: 8.5
Database: Informix

I have just started using Crystal reoports and am stuck on a date range issue....

I am attempting to design a report where I will specify a parameter field 'DateToday', and then create formula fields as follows:

If {table.transdate} in {?DateToday} and {?DateToday}-7, then {table.value}, else 0

If {table.transdate} in {?DateToday}-8 and {?DateToday}-14, then {table.value}, else 0

...and so on.

I understand that using 'in' requires a date range value from the parameter field, but I used to request a run-time parameter from the user (either from within a form or directly as part of the query) and then use the 'between x and y' function in MS Access to define ranges.

Crystal doesn't seem to have the 'between x and y' function... I'm sure I am missing something really simple but I can't seem to get my head around this one at the moment.

Any help much appreciated.
 
Use a date range parameter if that's what you want, Crystal has it as an option for the date parameter.

You didn't state the intent of these formulas, but it appears that you want to show some weekly sums.

A simpler means might be to use Running Totals and in the Evaluate->Use a formula place:

{table.transdate} in {?DateToday} and {?DateToday}-7

Another means might be to just use a Cross-Tab and in the group options select for each week.


As for your existing syntax, try:

If {table.transdate} in {?DateToday} to {?DateToday}-7, then
{table.value}
else
0

Note that I used TO, not AND.

-k
 
Sorry, there shouldn't have been a comma in there:

If {table.transdate} in {?DateToday} to {?DateToday}-7
then
{table.value}
else
0

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top