views:

369

answers:

2

HELP!!! THIS IS AN URGENT REQUEST!!

Hi

I'm trying to suppress a group header when there are no detailed results in another following group. I have added a manual running count total which is showing correct numbers (such as 0 when no records show on the report). I've taken this approach since I have various items suppressed within the detailed section and don't want them as part of the count.

I'm trying to say in the header not to shown the header if there are no corresponding records showing in the detailed section. But, it's not working. When I say suppress if the display count is 0, it suppresses all of the headers instead of just the ones that need to be displayed. HOW CAN I FIX THIS?

THANKS... Sarah

I figured it out on my own... I needed to create a subreport of the main report. I then added a shared variable, which will only work if the main report has the subreport in the section above the group header that needs the value passed to that group. The trick is not to suppress the section with the subreport and to make sure that the subreport is in the same group header (just a separate section of the same field being grouped).

Crystal is very tempermental when it comes to placement and Crystal version 10 will not pass a shared variable if the subreport is suppressed.

+1  A: 

This is an issue with the way that the report processes.

Crystal Report runs from the top down so if you have the running total in the header field the total to that point is not going to be the total for when the report reaches the group footer. This is probably why all of you group headers disappear when you put the suppress statement in.

There are two options that I can think. You can try to limit the data so that you can use a standard summary instead of a running total or you can roll your own running total.

If you can limit the data in a way that will allow you to use a standard count (Right-Click on the field and choose Insert/Summary) then you can reference the count of the field in the group. This method will work the way you are expecting.

Otherwise I believe that you'll have to roll your own running total like the one mentioned here. Here they go get the data and put it in a global variable and then use "WhilePrintingRecords" to either display the data or in your case use it in the suppress formula.

Hope this helps.

Edit in response to your answer/edit: Look closely at the link I sent. It gathers the information needed using WhileReadingRecords and then uses the value WhilePrintingRecords. If you are going to use this method, I think you'll need to create your own running total instead of using your current running total in your calculations. I believe that you'll have to increment and reset your global var with the count yourself. Hope this helps.

Dusty
Hi Dusty - For some reason, this Add Comment field didn't work on my machine yesterday.
Sarah
Yes - I'm using custom running count right now. But, it's not working for some reason.
Sarah
A: 

Thanks for your feedback, Dusty. But, I think I still need help.

My goal is to suppress a group header when the detailed runningcount=0. My runningcount is correct since it does not include suppressed records under the detailed section.

I'm using the following code right now and it's not working properly. ANy ideas why?? :)

UNDER GROUP HEADER (TEST1 field): ...................... Whileprintingrecords; Global booleanVar x := false;

UNDER DETAIL SECTION (TEST field): ...................... Whileprintingrecords; Global booleanVar x; if {@Display}<>0 then x := true else x := x

UNDER GROUP FOOTER (TEST2 field): .................... Whileprintingrecords; Global booleanVar x;

ANOTHER (DISPLAY) FIELD UNDER GROUP FOOTER: ................................ WhilePrintingRecords; Global NumberVar RunningCount; RunningCount;

Any help would be greatly appreciated. Thank you!!

Sarah
Go ahead and edit your question and add this there. You entered this as an answer which is generally reserved for people trying to answer your question. Some people tend to get a little fussy over it. :) I'll edit my answer in response to this while you move it.
Dusty
One of Dusty's comments bears repeating: "Crystal Report runs from the top down." In other words, Crystal cannot calculate a formula, then suppress something earlier in the report based on that formula. There are ways around this, but they can get incredibly complicated. Might I suggest modifying the data before it gets into Crystal Reports?
PowerUser
On a side note, his comments also describes why it's relatively easy to make a Table of Contents on the last page, but so difficult to move it to the front page (which is how I recognized the issue in the first place)
PowerUser