Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: if small caps then crred Post Reply Post New Topic
Page  of 2 Next >>
Author Message
belfane
Newbie
Newbie


Joined: 18 Apr 2013
Online Status: Offline
Posts: 21
Quote belfane Replybullet Topic: if small caps then crred
    Posted: 03 Mar 2016 at 5:07am
Hello,

I'm wondering if someone would be able to help with a formula for a font color change based on the data containing small caps.

Something like this:

if {this.table} = lowercaps then crred
else if {this.table} = uppercase then crblack
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Mar 2016 at 7:32am
there are probably better ways but here is one

if instr(lowercase({this.table}),{this.table},0)= 1 then crred else crblack
IP IP Logged
belfane
Newbie
Newbie


Joined: 18 Apr 2013
Online Status: Offline
Posts: 21
Quote belfane Replybullet Posted: 03 Mar 2016 at 9:42am
This worked flawlessly! Thank you very much!
IP IP Logged
belfane
Newbie
Newbie


Joined: 18 Apr 2013
Online Status: Offline
Posts: 21
Quote belfane Replybullet Posted: 03 Mar 2016 at 11:04am
Any chance you would part with a little more of your CR knowledge? The formula does work very well with all lower case. However, when there is a dash in-between, all of the data on every line turns red. Any ideas?

Works well for lower case: 2fh34r
Does not work for lower case: 2f-h34r

Thanks again!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Mar 2016 at 2:34am
Some basic tests using your sample string (2f-h34r) are not causing issues for me.
You can try and use a replace to remove the dash

instr(lowercase(replace('{this.table},"-","")),replace({this.table},"-",""),0)= 1

IP IP Logged
belfane
Newbie
Newbie


Joined: 18 Apr 2013
Online Status: Offline
Posts: 21
Quote belfane Replybullet Posted: 04 Mar 2016 at 3:31am
I tried your edited version, but received the following error:

The matching ' for this string is missing.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Mar 2016 at 3:40am
had an extra ' in it after the first replace. Just remove it

instr(lowercase(replace({this.table},"-","")),replace({this.table},"-",""),0)= 1
IP IP Logged
belfane
Newbie
Newbie


Joined: 18 Apr 2013
Online Status: Offline
Posts: 21
Quote belfane Replybullet Posted: 04 Mar 2016 at 3:45am
Thank you for your reply. I did try that, but was given another error:

"A number, or currency amount is required here."
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Mar 2016 at 3:49am
you replaced {this.table} with your field and it is a string, correct?
What did it highlight when you got the error?
IP IP Logged
belfane
Newbie
Newbie


Joined: 18 Apr 2013
Online Status: Offline
Posts: 21
Quote belfane Replybullet Posted: 04 Mar 2016 at 3:54am
Yes. That's the odd part, nothing is highlighted as you would suspect. It simply moves the cursor back to the beginning. In front of:

// This conditional formatting formula must return one of the following Color Constants:

As before, I'm adding the formula to the font color.
IP IP Logged
Page  of 2 Next >>
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.012 seconds.