Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: format Post Reply Post New Topic
Author Message
mikeb2
Newbie
Newbie


Joined: 28 Nov 2013
Online Status: Offline
Posts: 3
Quote mikeb2 Replybullet Topic: format
     Posted: 02 Dec 2013 at 2:35pm
I have a text field that I want to change the color of font when additional text is added. When additional text is added it starts off with a : to show its new.

I tried
If audit.notes like : then crRed else crBlack

Is it possible to do this?

Thanks
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 02 Dec 2013 at 7:01pm
Hi
 
Right click on the field and go in format field--Font--Color-- select formula editor and give below formula :
 
if left(trim({audit.notes}),1) =':' then CrRed Else CrGreen
 
 
Thanks,
Sastry
IP IP Logged
Craigdon
Newbie
Newbie


Joined: 17 Nov 2013
Online Status: Offline
Posts: 3
Quote Craigdon Replybullet Posted: 02 Dec 2013 at 7:09pm
Not sure if I've got this right, but if audit.notes contains a : then additional text has been added, so make all the text in the box red?
 
Something like
 
If Instr({Audit.Notes},":")<>0 Then crRed Else CrBlack
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 02 Dec 2013 at 7:17pm
Hi
 
Instr() function will check entire string for a particular value and gives you the position of the value.  If you have ':' in between your string also it will change the string color to Red.
 
Left() will check only first character, if first character is ':' then it will change the string color to Red
 
You want to change entire string color to Red or only ':' (i.e. first character) 
 
Thanks,
Sastry
IP IP Logged
mikeb2
Newbie
Newbie


Joined: 28 Nov 2013
Online Status: Offline
Posts: 3
Quote mikeb2 Replybullet Posted: 03 Dec 2013 at 3:19am

I wanted to turn the font red on any text after the :

However your suggestions do work and I can work with it. Thank You
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 04 Dec 2013 at 4:56am
It is a quandry. While CR itself will let you manipulate bolding and size etc in a text object at design time, it won't let you do the same programically...there it is all or nothing.

DBlank came up with a work around, in that you take 2(or more) formulas and drop them into the same text object, this way they will display correctly (no awkward spacing issues) and you can manipulate the font values (size, boldness, color) individually for each formula.

It is sure to take more work, but should allow you to do what you are after.

HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Dec 2013 at 8:03am
You can also use a formula that returns a string using HTML syntax and then use the display as HTML on the field
IP IP Logged
mikeb2
Newbie
Newbie


Joined: 28 Nov 2013
Online Status: Offline
Posts: 3
Quote mikeb2 Replybullet Posted: 04 Dec 2013 at 10:43am
Ok Thanks for all your help.
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