ndornack

asked on

# Variable Value dependent on a running sum

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?

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?

ASKER

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

"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

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

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