Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Change Font Color of crosstab field Post Reply Post New Topic
Author Message
ThakurS
Newbie
Newbie


Joined: 07 Dec 2011
Online Status: Offline
Posts: 9
Quote ThakurS Replybullet Topic: Change Font Color of crosstab field
    Posted: 26 Dec 2011 at 11:26pm

Hi,

Want to change the font color based on condition like when value is negative then display in RED color else display it in BLACK color.
Please note the data type used for this crosstab field is String as I need to display negative value in parenthesis

Example:

 -20 should be displayed as (20) and -45.34 % should be displayed as (45.34%)

I am able to achieve above scenario through “Highlighting Expert” of crosstab field.

Formula used

Value < 0 then font color = red
Value > = 0 then Font Color = Black

But the issue is when the value is not found m retrieving ‘-‘to display in cross tab. Since the field is string, it’s treating ‘-‘in first condition & displaying hyphen also in RED color.

I tried to used below formula in Font tab of “Format object” of crosstab field but m not getting expected result

Formula:
If INSTR ({Value from data table}, “(“) = 1 THEN
 RED
ELSE
 BLACK

Is it possible to display hyphen in Black color?
Please help... It’s urgent…

Thanks,
ThakurS



Edited by ThakurS - 26 Dec 2011 at 11:27pm
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 28 Dec 2011 at 12:12pm
1.  You don't have to convert to string.  Right-click on the number in your cross-tab, Format the field, go to the Number tab and select "Accounting Format".  I think this will also give you the '-'.
 
2.  Change your formula to check for null:
 
If IsNull({value from data table}) then BLACK
else if Left({value from data table}, 1) = '(' then RED
else BLACK
 
NOTE:  You ALWAYS have to check for null before doing any other checks! 
 
-Dell
IP IP Logged
ThakurS
Newbie
Newbie


Joined: 07 Dec 2011
Online Status: Offline
Posts: 9
Quote ThakurS Replybullet Posted: 01 Jan 2012 at 8:39pm
Hi,
 
Thanks for your input.
 
1. I have to use string field in cross tab as apart from '-' display, i have to display "(" for negative value and need to append "%" sign.
 
2. I tried using isnull also but It's not giving expected result. It is displaying all the data in BLACK color. It’s not recognizing "(" even in formula "Left({value from data table}, 1) = '(' "
 

Actually the problem with formula is "INSTR ({Value from data table}, “(“) = 1 " is not working in cross tab. but the same formula which i mentioned in my previous post was working in Detail section.

This is why i was using Highlighting Expect to achieve this.

 

Please give me your feedback on how to achieve this. Cry

Thanks,
ThakurS


Edited by ThakurS - 01 Jan 2012 at 8:51pm
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.