Print Page | Close Window

not surpressing the correct result

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22138
Printed Date: 02 May 2024 at 6:25pm


Topic: not surpressing the correct result
Posted By: Dangoo
Subject: not surpressing the correct result
Date Posted: 08 Nov 2016 at 4:51am
Hello,

I have created a shared number variable in a sub report to check if my report wants to suppress the details section or not in the main report. if the value is 0 then the details area is suppressed and if it is greater than 0 then it will remain un-supressed.

All is well and good in my report however, for some reason, the first details report that is 0 does not suppress?

The sub-report formula:

SHARED NUMBERVAR CHECK;

CHECK:= SUM ({@checker});


The Main Report formula:

SHARED NUMBERVAR CHECK;

CHECK


The Section Expert suppression formula:

{@CHECK} = 0




I know it is super simple and basic but I really can't see why it leaves an entry at the very top with a 0 in the check field?

any ideas?



Replies:
Posted By: DBlank
Date Posted: 08 Nov 2016 at 6:01am
is the shared variable result in the main report in a section above what it is suppressing?
Does the result handle nulls correctly?
Is the sub report suppressed? If so it will not run.


Posted By: Dangoo
Date Posted: 08 Nov 2016 at 10:18pm
- The subreport isn't suppressed.
- The subreport is in group header #1 and the shared variable formula is in the details section below.

- I am not sure what you mean by "Does the result handle nulls correctly?" I would presume that it would as the original formula that the shared variable is based on is:

IF {PROD_Product.Control_Item} = -1 THEN 1 ELSE 0

I hope this helps


Posted By: DBlank
Date Posted: 09 Nov 2016 at 4:23am
I am assuming the sub report is calculating the value and you are passing it back to the main report via the shared variable. The shared variable has to be placed in a section below the sub report to return the value created in that sub report. The shared variable has to be placed in a section above what it is trying to suppress in order for the suppression to work. If you have any null values and you don't handle them your shared variable might be returning a null instead of a 0 in which case it wold not suppress.
a simple test is to display the shared variable in the main report and read it form top to bottom to bottom and see what values are being pulled in then verifying the shared variable is always giving the expected result. Likely it is not the suppression criteria but rather the
returned value in the shared variable or the sequence in trying to suppress a section that exists above (or before) the shared variable exists.


Posted By: Dangoo
Date Posted: 09 Nov 2016 at 8:45pm
My report is meeting the above criteria and all of the fields are being suppressed which have a value of 0, except for some reason the last 0 at the front of the report is now being suppressed.

The suppressed fields: http://imgur.com/a/q7VFg

The un-suppressed fields: http://imgur.com/a/JeLMG

I can confirm that the first entry in the report is not suppressing but all the ones afterwards are.


Posted By: DBlank
Date Posted: 10 Nov 2016 at 2:57am
I have seen this in other posts where the issue is that it technically is not = 0 due to a very small fraction that is not being displayed with two decimal points.
You can try to round your result to 0 decimals and see if that is the issue

ROUND({@CHECK},0) = 0


Posted By: DBlank
Date Posted: 10 Nov 2016 at 2:58am
I have also seen others use a <1 instead of =0 as the results they wanted to show had to have at least a value of 1 so you could try that as an alternative as well.

{@CHECK} < 1


Posted By: Dangoo
Date Posted: 10 Nov 2016 at 9:50pm
there is no change in outcome when using {@CHECK} < 1 , it looks like the report isn't even considering the entry for suppression?


Posted By: DBlank
Date Posted: 11 Nov 2016 at 3:56am
can you explain exactly were you are placing the objects in th main report?
e.g.
subreport in GH1a
Shared variable in GH1b
suppression criteria on details section.



Print Page | Close Window