Print Page | Close Window

Total from Subreport

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=22117
Printed Date: 03 May 2024 at 12:42am


Topic: Total from Subreport
Posted By: Kitty1
Subject: Total from Subreport
Date Posted: 19 Oct 2016 at 3:58am
Hello, I am writing a report that i want to suppress the detail of if the total is zero. To get the total before I get into the detail, i placed a subreport in the group header section which adds up the detail, then i used shared variable to pass the total from the subreport to the main report. I then told the detail to suppress if that field is equal to zero. It is not working correctly. I even printed the field from the main report just to make sure it is returning the correct value, and it is.   I cannot understand why this would not work. It seems so simple. Any ideas ?



Replies:
Posted By: kevlray
Date Posted: 19 Oct 2016 at 4:10am
Not sure.  So you have verified that the sub-report variable is being set correctly by viewing it in the details section (via formula)? 


Posted By: Kitty1
Date Posted: 19 Oct 2016 at 4:16am
Hi, yes the total of both fields in the sub-report and main report are correct. I placed the sub-report in the group header, then added another section to the group header to show the value, just so that i could make sure it equalled the total in the detail section, which it does. So confused as to why this is not working. I have moved both the sub-report and the field around to different sections, just grasping at straws.


Posted By: DBlank
Date Posted: 20 Oct 2016 at 6:35am
I assume you have multiple groups so you have a group header A that is setting the value to 0, a group header B executing the sub report and a group header C to return the shared variable back into the main report.
you are displaying the main report shared variable in group header C to validate each groups value is 'correct'.
This is not suppressing anything or only somethings?


Posted By: kevlray
Date Posted: 20 Oct 2016 at 6:44am
I am not saying that you did this (I sure have), but did you confirm the shared variable name that you have for detail suppression is the same shared variable name that is used in the sub-report.


Posted By: Kitty1
Date Posted: 20 Oct 2016 at 7:37am
Hi kevlray & DBlank, thanks for the replies. I did check the shared variable and confirmed it is correct. I have found something even stranger now. i "un-suppressed" everything and the section is being suppressed on certain invoices only. There seems to be no rhyme or reason as to why some are and some are not. it is supposed to suppress any invoice (which it is grouped by) that has zero balance.


Posted By: kevlray
Date Posted: 20 Oct 2016 at 11:33am
Almost seems that the shared variable is getting set by another process.  Hard to say without going through the report very carefully.


Posted By: Kitty1
Date Posted: 20 Oct 2016 at 11:47am
thanks, yea i can't see anything that would make it do this. i'm going to put it on the back burner for a while, then maybe go back to it. Thanks for all your input! :)


Posted By: Kitty1
Date Posted: 11 Nov 2016 at 7:40am
Hi, I am back at this again!   I have gone through everything in this report looking for any possible reason for this behavior and I am coming up with nothing. Very frustrating. Most all of the zero invoices are being suppressed, but certain ones are not and I see no difference in any way with these that are showing up. anyone have any other suggestions?


Posted By: DBlank
Date Posted: 14 Nov 2016 at 2:58am
Create a formula that is your suppression formula and place it in the section that you want suppressed. I would suggest that you then look to see how the suppression is showing compared to the shared variable. Are you actually suppressing based on the prior shared variable (from the group above?)


Posted By: Kitty1
Date Posted: 14 Nov 2016 at 3:03am
Good Morning DBlank, thank you for the reply. Yes I am suppressing from the subreport value which is passed into the main report.   The subreport is in the group header.   I actually entered the values for the field and it is showing correctly, only the detail is showing too. only on some.   What would my formula look like ?   Thanks.


Posted By: DBlank
Date Posted: 14 Nov 2016 at 3:09am
please explain your set up, something like this

GH1a: subreport
GH1b: shared variable placement in main report
GH1c: conditionally suppressed group header data
details: conditionally suppressed
GF1: conditionally suppressed


Posted By: Kitty1
Date Posted: 14 Nov 2016 at 3:21am
GH1a: subreport
GH1b: shared variable placement
Details: conditionally suppressed based on shared var.
GF1 Totals
(I have no group header data to suppress.)



Posted By: DBlank
Date Posted: 14 Nov 2016 at 3:25am
and you are only trying to suppress the detail sections?

Take your suppression criteria from the details section and copy it into a new formula field (like 'suppress_test') and place it in the detail section to see if it shows a T or F


Posted By: Kitty1
Date Posted: 14 Nov 2016 at 3:26am
sorry. i am trying to suppress the detail and the GF sections both.


Posted By: DBlank
Date Posted: 14 Nov 2016 at 3:28am
ad the 'suppress_test' formula to both sections to see what it is doing


Posted By: Kitty1
Date Posted: 14 Nov 2016 at 3:28am
Also, what would the formula look like.   all my detail section shows is mainformula=0


Posted By: DBlank
Date Posted: 14 Nov 2016 at 3:30am
that is all you would add then
it will return a true or false (or possibly a NULL).

another possibility is that you are seeing zero but it is actually something like .0000000000001 so it is technically not 0.
try the suppress formula first


Posted By: Kitty1
Date Posted: 14 Nov 2016 at 3:33am
i'm sorry...not sure if i'm doing this right.

so my formula would look like this:

SuppressTest

mainformula=0

or do i need to add a suppress comment somewhere in the formula ?


Posted By: Kitty1
Date Posted: 14 Nov 2016 at 3:34am
o.k. i did that and it is saying false on every detail section...


Posted By: DBlank
Date Posted: 14 Nov 2016 at 3:36am
wherever it is false it is a 'show' and wherever it is 'true' it is a suppress.


Posted By: Kitty1
Date Posted: 14 Nov 2016 at 3:46am
I just showed the decimals as many as i could show, and it is all zeros. 0.0000000000


Posted By: Kitty1
Date Posted: 14 Nov 2016 at 3:51am
I'M REALLY CONFUSED BECAUSE I AM SHOWING THE SuppressTest field which shows "FALSE" right next to where i placed the MainReport field and that shows zero


Posted By: DBlank
Date Posted: 14 Nov 2016 at 4:10am
change your test suppression from "=0" to <1


Posted By: DBlank
Date Posted: 14 Nov 2016 at 4:12am
what is the 'mainformula' code?


Posted By: Kitty1
Date Posted: 14 Nov 2016 at 4:18am
sorry, not sure what you mean by changing the test suppression. should it just say mainformula<1 ? i'm getting an error

MAINFORMULA = Shared CurrencyVar X;X:=X;

(actually the formula name is MAINREPORT... sorry.)


Posted By: Kitty1
Date Posted: 14 Nov 2016 at 7:48am
Hi again, I changed the suppression formula to <1 and now it is working, with the exception of now it doesn't show credit balance invoices... SO CLOSE! any idea how I can get it to show credit balances ?


Posted By: Kitty1
Date Posted: 14 Nov 2016 at 8:42am
i think I got it!!   need to do more testing first though.

{@MAINREPORT}<1 and {@MAINREPORT}>-.01

thank you so much for your guidance in the right direction...I will let you know how it goes after doing some testing on more customers!



Print Page | Close Window