Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Variable loses it value on manual RT Post Reply Post New Topic
Author Message
tconway
Newbie
Newbie
Avatar

Joined: 25 Dec 2007
Location: United States
Online Status: Offline
Posts: 20
Quote tconway Replybullet Topic: Variable loses it value on manual RT
     Posted: 13 Mar 2008 at 3:03pm

I have some manual running totals where the variables start losing their values on a page break. 

This is kind of involved, but here goes. 
 
This report is made up of of five groups, #1 is Sales Manager, #2 Salesperson, #3 Customer, #4 Item Group and #5 Item.  It shows 4 periods that are date ranges, such as Nov 1 to 30, Dec 1 to 31 and so on.  These are entered by the user in 4 parameter date fields and can be anthing.  The values displayed in each period are Qty Sold and Amt Sold. 
 
 
The display of values goes like this:
 
Sales Manger:   TOM
Salesperson:     JOE
Customer:          ABC Company
Item Group:         1000
                           (Average)   Per1Qty     Per1Amt    Per2Qty    Per2Amt
Item ID:               1001              10               200           5              100
                           1002               2                500           4             1000  
                           1003               1                150           1               150
Footer
Item Group:          (Sum)             13               850           10             1250
 
 
I chose an RT field (not manual) to first calculate the average value because of the Date Range Parameter.  The RT allows me to Evaluate based on a formula, i.e., the date range parameters. 
 
But once the Average is returned, to sum the average values I put a variable in CSS Class Name formating of the RT to capture the RT Value into a variable.  I then do a manual RT with a START formula field (set variable to 0), the RT formula, and finally the display formula.  The variables are Global.
 
This works great. 
 
Here's the problem.  I need to continue totaling these values into the groups going down, i.e., Customer, Salesperson and Sales Manger. 
 
Customer works well.  Here I created a second set of 3 manual RT formulas and added a new totaling variable, but used the original average variable again for totaling. 
 
But when I do this a third time on Salesperson it will work only intermittently.  Sometimes it's fine, others it will reset to 0 on the next page.  Then, if I refresh and page through again, the numbers will appear the next time, or maybe not.
 
Does anyone know if variables have a limit as to how far they can be used?  Or is there a better technique to summing an average RT field. 
 
Thanks
 
Tim
IP IP Logged
tconway
Newbie
Newbie
Avatar

Joined: 25 Dec 2007
Location: United States
Online Status: Offline
Posts: 20
Quote tconway Replybullet Posted: 14 Mar 2008 at 6:25am
OK, just in case someone runs into this...
For some strange reason, although resetting the value back to zero on the change of the group works correctly on the first two groups ItemID and ItemGroup, that is, once the group moves to the next value in the group, the totaling variable is set to zero, this is not the case with the third group Salesperson.  Note the major difference here is that the Salesperson may not change for some 20 or 30 pages, where an ItemID or ItemGroup will change no more than a page or two.  This is the strange behavior I encountered. 
 
The Salesperson manual running total would total correctly for about 4 pages then suddenly on a Page Break reset the totaling variable to 0, even though it had NOT moved to the next salesperson. 
 
To fix this I added the code to the Reset formula of the manual running total to
If Previous(Salesperson) <> Salesperson then slsprsncount := 0
 
That fixed it. 
 
You learn something new everyday, the only problem is you lose some much hair in the process!
 
Tim
IP IP Logged
tconway
Newbie
Newbie
Avatar

Joined: 25 Dec 2007
Location: United States
Online Status: Offline
Posts: 20
Quote tconway Replybullet Posted: 14 Mar 2008 at 7:13am
Nope, spoke too soon
 
On running other examples, the values still get lost.
 
Oh well...
 
 
IP IP Logged
tconway
Newbie
Newbie
Avatar

Joined: 25 Dec 2007
Location: United States
Online Status: Offline
Posts: 20
Quote tconway Replybullet Posted: 14 Mar 2008 at 7:57am
OK, one last post on this then it's time to move on with life
 
This does work, but only if you page through the report one page at a time.  It appears the values are not captured into the variables if you skip pages, say using the group tree to jump to a section you want to see.  
 
I started on creating a Manual Running Total to calculate an Average.  But since it's based on a date value a user would put in it gets so complex it's just not worth it, so I bailed out. 
 
If anyone has any experience with this, I'd love to know if there's a workaround. 
 
Thanks
 
Tim 
IP IP Logged
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