Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Troublesome report and running totals Post Reply Post New Topic
Page  of 2 Next >>
Author Message
huddy33
Groupie
Groupie


Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 54
Quote huddy33 Replybullet Topic: Troublesome report and running totals
     Posted: 09 Apr 2010 at 10:13am
This is the report description:

report is grouped on:

Quarter (startdate of event, printed for each quarter)
Status of event
EventID


All fields, from various tables, are are placed in GH3a (eventID), showing event details
GH3b has a three field labels from event_changes table
Details section has the three fields from event_changes table, detailing what may have changed in this record during a parameter filled date

I have had major issues with this report and running totals in GF2 and GF3, where the RT's are reading the event fee for each record times as many instances of change (this could be three, four or five times!).  The problem with this is that that fee is only being charged once, not 3, 4, 5 times, so the running totals are significantly off. 

In GF2, I was able to use a RT on Event.Fee, evaluating it on change of group EventID and resetting it on change of status, and avoid dup fee addition. 

To avoid using running totals and experiencing this issue, I created a formula to sum the eventfee field if quarter and status equaled what I needed them to (example:
If {LookUp_ContractStatus.ContractStatusID}=3 or {LookUp_ContractStatus.ContractStatusID}=6 then
    {Event.Fee}).

I then did a RT on this field summing it by evaluating it on change of field eventID and resetting it on change of group quarter.  This has worked fine for GF3 to avoid dup fee addition. 

My major issue now is the report footer.  I need to sum the Event.Fee across all statuses for each quarter...this will not return the correct value by using any combo of evaluating on groups/fields and resetting on groups/fields.  It always adds multiple values wherever there is more than one record in event_changes.  I am at a loss here on how to proceed. I also need to sum all event.fees for the time parameter I enter in a separate field.  None of these needs can be met.  Any help is appreciated.



IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Apr 2010 at 10:35am
Can you post some sample data and expected outcomes
IP IP Logged
huddy33
Groupie
Groupie


Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 54
Quote huddy33 Replybullet Posted: 09 Apr 2010 at 11:49am
Here's a sample for a small date range.


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Apr 2010 at 6:20am
It is really hard to tell from this but you can use formulas for evaluating the data in Running Totals. You likely need to do a SUM of the field and then do a longer eval formula that uses your conditions plus another condition using the previous() or Next() field so it only evaluates once per time you want it to (ignoring the 2 extra rows). something like
({LookUp_ContractStatus.ContractStatusID}=3 or {LookUp_ContractStatus.ContractStatusID}=6) and next(eventname)<>eventname
IP IP Logged
huddy33
Groupie
Groupie


Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 54
Quote huddy33 Replybullet Posted: 12 Apr 2010 at 2:37am
I'm afraid I don't understand.  How do I determine whether or not yo use Previous or Next...the totals I need to see differ based on which of these I use.
IP IP Logged
huddy33
Groupie
Groupie


Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 54
Quote huddy33 Replybullet Posted: 19 Apr 2010 at 2:35am
bump
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Apr 2010 at 4:24am
can you post the detail level data and show how you want it summed?

Edited by DBlank - 19 Apr 2010 at 4:24am
IP IP Logged
huddy33
Groupie
Groupie


Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 54
Quote huddy33 Replybullet Posted: 19 Apr 2010 at 8:29am
DBlank, that is what I posted on 09 Apr 2010 at 11:49am in the image above.  You can see where the rt's in the report footer are grabbing the last line of data in the group ($20,468) twice to read $82,270 instead of the $61,802 shown in the quarter footer. 

I'm at a loss on how to fix this using the next/previous and onfirstrecord/onlastrecord pieces.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Apr 2010 at 10:51am
Sorry. It is really hard to tell the row level data in that post. Example that there appears not to be a display of the eventg id which is key to the way your RTs are functioning. Also it appears that you have all the dupe rows already suppressed which makes it hard for me to see what the real data looks like, not this already altered version. In order for me to create an RT I have to understand the full scope of the data and how it is grouped, not just how it is currently displayed.
I will still try to help you but I am working in the dark some.
In the RT when you need to do a conditional inclusion of the value you can tell it to 'Use a formula" in the evaluate portion. However that means you cannot use the evaluate on change of a group. To accomidate that you can write in an additional formula part to mimic that as:
Next(table.eventID)<>table.eventid
This will only use one row per 'grouping' of eventid (the last row of the grouping in this case).
So based on your row level data you could use this as part of a RT evaluation formula to try and exclude the duplicated data.
Does any of this help?
IP IP Logged
huddy33
Groupie
Groupie


Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 54
Quote huddy33 Replybullet Posted: 20 Apr 2010 at 7:45am
Okay, here are some images that I could put together to hopefully give you more clarity.  Depending on the date range I set in the parameter and what data shows, the report may or may not be correct.  The word example shows where the report pulls incorrectly, not adding totals as it should.  The image should show you design view, along with how I am evaluating the incorrect RT's.  It all has to do with using that "next" function, I know that, but don't know how to work around it.  If you can help with why this isn't working, I will be eternally grateful!

Design View:

http://img.photobucket.com/albums/v354/floyd33/DesignView-2.jpg

Report View:
http://img.photobucket.com/albums/v354/floyd33/ReportView.jpg




Edited by huddy33 - 20 Apr 2010 at 7:53am
IP IP Logged
Page  of 2 Next >>
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