Solved

Variable Value dependent on a running sum

Posted on 2013-05-13
3
344 Views
Last Modified: 2013-05-13
I am using Crystal Reports 8.  I have a select case statement that calculates a point value:

Global numberVar  Points:=0 ;
Select {LaborDtl.ExpenseCode}
  case "TA0":
    Points := 0
  case "TA1":
    Points := 1
  case "TA5":
    Points := .5
    case "TABD":
    /* NEED SOME HELP HERE******/
  default:
    Points := 0

when I get to the case "TABD" I need to assign the points based on the running sum of points for the employee I am processing.

if running sum = 1, then points s/b = 6
if running sum = 2, then points s/b = 5
if running sum = 3, then points s/b = 4
if running sum = 4, then points s/b = 3
if running sum = 5, then points s/b = 2
if running sum >= 6, then points s/b = 1

How can I accomplish this?
0
Comment
Question by:ndornack
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 39162467
Are you calculating a value for a running total and trying to use the running total in the calculataion?

WHat you want will be done like
(
If {#RunningTotal} = 1 then
    Points := 6
Else If {#RunningTotal} = 2 then
    Points := 5
Else If {#RunningTotal} = 3 then
    Points := 4
Else If {#RunningTotal} = 4 then
    Points := 3
Else If {#RunningTotal} = 5 then
    Points := 2
Else If {#RunningTotal} = 6 then
    Points := 1
)

You could also try using
   7 - {#RunningTotal}

mlmcc
0
 

Author Comment

by:ndornack
ID: 39162547
This is what I have now, and I am getting the ERROR:

"One of operands is a running total field which is using this formula"

Global numberVar  Points:=0 ;
Select {LaborDtl.ExpenseCode}
  case "TA0":
    Points := 0
  case "TA1":
    Points := 1
  case "TA5":
    Points := .5
  case "TABD":
    (
    if {#PointsTotal} =  1 then
      Points := 6
    else if {#PointsTotal} = 2 then
      Points := 5
    else if {#PointsTotal} = 3 then
      Points := 4
    else if {#PointsTotal} = 4 then
      Points := 3
    else if {#PointsTotal} = 5 then
      Points := 2
    else if {#PointsTotal} = 6 then
      Points := 1
    )
  default:
    Points := 0
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 39162671
If you are trying to use this as the basis for the PointsTotal running total, you can't.

I know statements like  a := a + 1 make sense (sort of) in a program, but a running total cannot refer to itself.
mlmcc
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question