Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Calculating totals with suppressed fields Post Reply Post New Topic
Author Message
KSAnalyst
Newbie
Newbie
Avatar

Joined: 04 Mar 2008
Location: United States
Online Status: Offline
Posts: 29
Quote KSAnalyst Replybullet Topic: Calculating totals with suppressed fields
    Posted: 11 Dec 2008 at 2:42pm
Good afternoon.
 
I am using CRXI SP2.
 
I am attempting to compute totals of only data elements that are not suppressed due to duplication.  Here is my code below:
 
This is for my suppressed variable:
 
If{staff_tx_history.SERVICE_CODE}= "3510" or {staff_tx_history.SERVICE_CODE}="3570" and
   {staff_tx_history.SERVICE_CODE}=previous({staff_tx_history.SERVICE_CODE}) and
   {staff_tx_history.date_of_service}=previous({staff_tx_history.date_of_service}) and
   {staff_tx_history.duration}=previous({staff_tx_history.duration}) and
   {staff_tx_history.number_clients_in_group}=previous({staff_tx_history.number_clients_in_group}) then true
else false
 
This is the formula in the description section
   
whileprintingrecords;
global numbervar TTLNONSUP;
Global numbervar TTLREST;
if ({@Previous Suppress}) = false then
TTLNONSUP:=sum({@Duration w/group}, {staff_tx_history.date_of_service}, "daily") else
TTLREST:= TTLREST
 
This is the formula in the Header to reset the global.
 
Whileprintingrecords;
Global numbervar TTLNONSUB:=0;
global numbervar TTLREST:=0;
 
This is my total section in the group footer:
 
Whileprintingrecords;
Global numbervar TTLNONSUP;
Global numbervar TTLREST;
TTLREST:= TTLREST + TTLNONSUP
 
This works fine when there are no suppressed fields but when there are suppressed fields, the total is comprised of the suppressed data and not the unsuppressed.
 
Could someone help?
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 12 Dec 2008 at 6:22am

I think that it is minor logic bug.  'And' is executed before 'Or', so put parenthesises around the SERVICE_CODE clause.  What I think you mean is this:

If ({staff_tx_history.SERVICE_CODE}= "3510" or {staff_tx_history.SERVICE_CODE}="3570" ) and
   {staff_tx_history.SERVICE_CODE}=previous({staff_tx_history.SERVICE_CODE}) and
   {staff_tx_history.date_of_service}=previous({staff_tx_history.date_of_service}) and
   {staff_tx_history.duration}=previous({staff_tx_history.duration}) and
   {staff_tx_history.number_clients_in_group}=previous({staff_tx_history.number_clients_in_group}) then true
else false
 
Hope this it the issue. 
IP IP Logged
KSAnalyst
Newbie
Newbie
Avatar

Joined: 04 Mar 2008
Location: United States
Online Status: Offline
Posts: 29
Quote KSAnalyst Replybullet Posted: 17 Dec 2008 at 8:26am
Thank you,
 
I think this was part of the issue however, the report still does not compute the total minutes of those data elements that are not suppressed.
 
Thanks again,
 
Kevin
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.015 seconds.