cancel
Showing results for 
Search instead for 
Did you mean: 

How to suppress all details and header based on value of one detail

curt_dalgleish
Explorer
0 Kudos

I'm having trouble figuring out what seems like a simple request. We have a Crystal report (XI R2) that shows insurance claims. Data related to claims is displayed in Group Headers. Each claim can have multiple "tasks" displayed in the details section under the Header.

If one of the detail records within the claim has a certain value then we need to suppress all detail records and header for that claim. I thought it sounded easy...

This example might make more sense:

I read a different post where someone had the exact same issue but I don't think he figured it out. It was someone doing a report on prisoners (header). The report showed all convictions (details) for each prisoner. If a prisoner was conviction of X then don't display the prisoner or any of his convictions.

Any suggestions would be appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I'm not sure V's solution will work...

Create a formula field something like (basic syntax):


' @SuppressSection:
if {field} = "suppress value" then
  formula = 1
else
  formula = 0
end if

Then, suppress the group header, footer and details on the expressioin


maximum(@{SuppressSection}, {group field}) = 1

HTH,

Carl

Former Member
0 Kudos

Hi Carl, I like your solution better. I did not test mine, just off the cuff. But hey, worth every penny of what it cost...

Thanks V

curt_dalgleish
Explorer
0 Kudos

Carl, thanks for the great example. I have it partially working:

1. The headers get suppressed when they should.

2. The claim detail records that trigger the suppression are also suppressed.

However, I need to suppress ALL details in claims that have {PendingClaims.TASK_TYPE_CODE} = "SR". A claim can have many other details with other task_type_codes and I need to suppress all details in claims with any task_type_code = "SR"

'@SuppressSection Formula Field:

if {PendingClaims.TASK_TYPE_CODE} = "SR" then

formula = 1

else

formula = 0

end if

Here's Header Suppression formula:

maximum({@SuppressSection}, {@Sort2Formula}) = 1

But if I add the same to the details suppression formula only the details where {PendingClaims.TASK_TYPE_CODE} = "SR" are suppressed. I need to suppress all detail records for that claim.

Thanks again for any suggestions.

Former Member
0 Kudos

If you can't use the exact same formula for the detail section that you're using for the header (I can't think of a reason why not), then in the header suppression formula, add a global variable that saves whether or not the group header was suppressed, then use that to suppress the details.

HTH,

Carl

curt_dalgleish
Explorer
0 Kudos

Carl, everything is working now ... both header and detail suppression. I had to work your detail suppression formula into an existing suppression formula. Thanks again for your simple and elegant solution!

Former Member
0 Kudos

Can you please explain how you finally got it to work

JWiseman
Active Contributor
0 Kudos

hi Mohamed,

this is a very old post and unfortunately we haven't heard from Carl in a while which is too bad. if the answer below does not help, please create a new post.

one solution to this is Group Selection filters. for example, if you're trying to eliminate a group where one or more of the values for {field1} = 'valueA' then you would do the following:

1) create a formula that reads

     if {field1} = 'valueA' then 1

2) place the new formula on the details section and suppress it

3) right click on the formula and choose Insert > Summary and then do a Sum type and change it so that it's on the group level

4) now go into the Report menu > Selection Formula > Group and enter syntax like

     sum({yourformula},{yourgroup}) > 0

the above steps will suppress an entire group if valueA is found in the subset of records in that group.

please note though that a group filter does not eliminate records from being returned to crystal...it only suppresses them. so any totals that you do you must ensure that you create formulae that will not count those records that are being suppressed.

i hope this helps,

jamie

Former Member
0 Kudos

Thanks Jamie for your input but I think this solution won't work because the formula that you suggested won't be summarized according to crystal reports

JWiseman
Active Contributor
0 Kudos

hi Mohamed,

sure it will work there's a sample attached on how to do group selection using this method. please change the file extension from .txt to .rpt after you've extracted it.

please note the syntax that you need to use. whileprintingrecords (used in manual running totals) cannot be used in crystal summaries. however, in this case, you don't need a manual running total as you're creating a flag that doesn't require a variable.

    if {Orders.Order Amount} > {?OrderLimit}

        then 1

in this sample, only customers that have at least one order greater than the user entered parameter are shown.

cheers,

jamie

Answers (4)

Answers (4)

Former Member
0 Kudos

I got and here is how:

I've created a manual running total using 3 formulas

@1st:

Whileprintingrecords;

Numbervar X:=0;

@2nd:

Whileprintingrecords;

NumberVar X;

if {Field}="Value" Then X:= X+1

@3rd:

Whileprintingrecords;

NumberVar X;

and then in the suppression formula of the details section I entered the syntax:

@2nd >0 or @3rd >0

and applied the same in the group header and footer section expert

finally got it to work

Former Member
0 Kudos

HELP!! I have a similar problem..

How can I suppress a group header based on the results of a runningcount in the associated group footer?

My runningcount is correct, but I can get the report to suppress the related header when the detail is null. The detailed section contains a lot of custom suppressed records.

PLEASE HELP! THANKS.

Former Member
0 Kudos

"How can I suppress a group header based on the results of a runningcount in the associated group footer?"

You can not evaluate a running total before it appears on the report. If you attempt this it will look at the last value of the running total in the previous footer.

Debi

curt_dalgleish
Explorer
0 Kudos

Thanks for your suggestion. Since you like Carl's idea better, I'll try his first. You would know better than me!

Former Member
0 Kudos

hey Curt, just a shot in the dark. Create a formula that will look at your detail item.

we will call it is_it_true

if = "Widget" then true

drop this into the details section, and you should see True when detail_item = Widget, and false everywhere else.

you should then be able to build a suppression formula that looks at the result of the details formula.

( You may have to make this a shared variable )...

Anyway, create your suppresion formula where ever it needs to go. and refer to the formula

@is_it_true

when @is_it_true is true, then the sections should suppress