Author |
Message |
GrisCorp
Groupie
Joined: 08 Mar 2013
Online Status: Offline
Posts: 64
|
Topic: Zero Shared variable when group larger than 1 page Posted: 12 Nov 2021 at 10:37am |
I have a Crystal Report with several subreports. I have a Sum in the Report Footer of two of those reports and a shared numbervar that equals those Sums:
shared numbervar TtlDemand;
TtlDemand := Sum ({Requirement_Detail.DUEQTY_11})
shared numbervar TtlOnOrder;
TtlOnOrder := Sum ({@DueQty});
In the main report I have four Group Footers for the single Group in the report (Group Header and Details are suppressed):
1a (which contains the all the display fields
1b which contains:
shared numbervar TtlDemand;
shared numbervar TtlOnOrder;
1c (suppressed) which contains the reset formulas
and
1d which is blank and is only used to create a space between one group record and the next during output/export
I have it setup this way in order to pass the sums to one of the group footers in the main report because all of the subreports each have a different number of records in them, so leaving the Report footer in the subreport unsuppressed will not help me to keep the sums all on one line in the finished report.
When running the report, for any group that is able to display on one single page, the shared variable displays the correct amount.
However, if the subreport, and thus the group, spans onto 2 or more pages, the shared variable displays 0.00. In the Crystal Reports Preview, if I double-click on that 0.00, it opens up another Preview window of just that group but without all the Report and Page headers/footers; it is just the group. When scrolling to the last page, the shared variable displays the correct amount.
I cannot figure out how to get it to display properly. I have put the reset formulas in the group header, a lower group footer, and even removed them altogether, all to no avail.
I am unsure what other information you might need to assist.
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 15 Nov 2021 at 5:31am |
Simply clarifying, for page 1 of the report, the shared variable is incorrect, and it is correct on the last page of the group?
Thanks
|
IP Logged |
|
GrisCorp
Groupie
Joined: 08 Mar 2013
Online Status: Offline
Posts: 64
|
Posted: 15 Nov 2021 at 5:47am |
The shared variable prints in the Group Footer. So, if the entire group can fit on one page, the shared variable displays correctly. But, when the group spans more than 1 page, the shared variable displays incorrectly on the last page of the group.
I've even tried putting the shared variable in the same Group Footer as the subreport (group footer 1a) but it doesn't fix the issue.
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 15 Nov 2021 at 10:32am |
Whew! I was worried that the group footer was displaying at the wrong time.
I would look for a page header/footer that is resetting the variable. The variable should persist across pages/the whole report without any problems...I have used them that way.
I suspect that there is a formula running somewhere that is resetting it when the page changes.
Not much help, I know. Have you tried using the search tool? Sometimes it finds what I am after.
I would also build a little test formula:
shared numbervar TtlOnOrder
and display in different sections of the report. Perhaps you will see it change from the correct value to 0, and that can help you zero in on the where and the why of it reseting.
HTH
|
IP Logged |
|
|