Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: not surpressing the correct result Post Reply Post New Topic
Author Message
Dangoo
Newbie
Newbie


Joined: 13 Jan 2015
Online Status: Offline
Posts: 19
Quote Dangoo Replybullet Topic: not surpressing the correct result
    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?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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.
IP IP Logged
Dangoo
Newbie
Newbie


Joined: 13 Jan 2015
Online Status: Offline
Posts: 19
Quote Dangoo Replybullet 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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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.
IP IP Logged
Dangoo
Newbie
Newbie


Joined: 13 Jan 2015
Online Status: Offline
Posts: 19
Quote Dangoo Replybullet 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.

Edited by Dangoo - 09 Nov 2016 at 8:50pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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

Edited by DBlank - 10 Nov 2016 at 2:59am
IP IP Logged
Dangoo
Newbie
Newbie


Joined: 13 Jan 2015
Online Status: Offline
Posts: 19
Quote Dangoo Replybullet 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?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.