Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional formatting whilst using variables

Status
Not open for further replies.

Willie78

Technical User
Jun 4, 2004
67
GB
Hi everybody I have an issue with a Cr XI report.

I have a formula that looks like this

Numbervar range Lowprofit:=0 to 0.24;
Numbervar range normalprofit:=0.25 to 0.40;
numbervar cpratio:={Profit.Profit}/{Profit.Cost};
Stringvar Message;

if cpratio in lowprofit then message:="Below average " & totext(cpratio,2) else
if cpratio in normalprofit then message:="Average " & totext(cpratio,2) else message:="Above Average " & totext(cpratio,2)

Basically working out profit % from two fields, then adding some test to the result.

This works fine. On this formula field i have tried to add in some conditional formatting like so

whileprintingrecords;
evaluateafter({@Performance});
stringvar message;
stringvar left2:=left(message,2);


if left2 = "Be" then crRed else if left2 = "Av" then crGreen else crBlue

The problem is that all the answers come out green though the data varies. I can't understand why this is.

Can anyone help me?

Cheers

Paul W

 
try referring to the actual formula i.e.

Code:
if left({@Performance},2) = 'Be' then
     CrRed
Else if left({@Performance},2) = 'Av' then
     CrGreen
Else
     CrBlue

HTH

Gary Parker
MIS Data Analyst
Manchester, England
 
Gary

That works fine thanks. My confusion is still with my first formula though =. I was trying to use variables in CR as they are new to me so i thought i'd give them a go; maybe not the be thing to do

Cheers

Paul W
 
Paul

It's probably just to do with evaluation time, you could try

Code:
Numbervar range Lowprofit:=0 to 0.24;
Numbervar range normalprofit:=0.25 to 0.40;
numbervar cpratio:={Profit.Profit}/{Profit.Cost};
shared Stringvar Message;

and

Code:
evaluateafter({@Performance});
shared stringvar message;
stringvar left2:=left(message,2);

if left2 = "Be" then crRed else if left2 = "Av" then crGreen else crBlue

Gary Parker
MIS Data Analyst
Manchester, England
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top