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

User control of "This section will be printed" 1

Status
Not open for further replies.

teknogeek9

Programmer
Jan 6, 2001
47
US
Using CR XI, is there a function that allows for dynamic control of "This section will be printed"? The users want to be able to print the report with totals by week or totals by month. They will get one or the other but not both.

I have a report that has a detail section of daily transactions. The secondgroup is a sum of these transactions with a group by date and a print for each week. The firstgroup is a sum of these transactions with a group by date and a print for each month.

The problem with the above is because I have a month group, the "week end" is the last day of the month and not necessarily the end of the week.

So, I thought I would have one group controlled by a parameter and depending on what timeframe the user picks, either the totals will be on a week basis or a month basis.
 
Create 2 groups, one by month and one by week. Based on a parameter field that prompts them for what they want, conditionally suppress the group you do not want to see.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
The problem with doing that is with the month being group 1 and week being group 2, the week will stop at the end of the month. And that may not necessarily be an end of the week.
 
Do you have multiple weeks/months perreport or just one?

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
Multiple weeks/months. The data spans at least a year.
 
Set up a string parameter {?group interval} with options "Monthly" and "Weekly". Then create a formula like:

if {?groupinterval} = "Monthly" then
date(year({table.date}),month({table.date}),1) else
dateadd("ww",datepart("ww",{table.date})-1,
date(year({table.date}),1,1)-
dayofweek(date(year({table.date}),1,1)+1)

Insert a group on this formula.

-LB
 
The monthly version totals correctly; the weekly does not total at all. There is a parentheses missing so I added it to the end.

I showed the formula on the detail line to see what it was returning and it returns the week begin date. Yet, it won't total by that group.
 
Wish there was a way to delete a post....

lbass' solution works very well. I had a group suppression on for the Weekly value.

Thank you lbass
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top