开发者

How to suppress a group header based on running-count results?

开发者 https://www.devze.com 2022-12-31 09:04 出处:网络
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 recor

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 suppress开发者_开发问答ed 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?

EDIT

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.


Try this, Go to the section expert and select the section you want to suppress. Go to the formula section "Supress (No Drill-Down)" and input the following formula.

Count({LIB_MARC_DETAILS.MARC_DATA}, {LIB_BIBLIO.RSN})<2

The first field is the field to count. The second field is the field used for grouping. Lastly the condition to suppress by (In this case it will suppress that section for any group containing less than 2 records)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消