Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Conditional Formatting Post Reply Post New Topic
Author Message
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Topic: Conditional Formatting
    Posted: 07 Jul 2008 at 2:43am
At beginning hi to all forum
In the second i have a problem:
i have to put a conditional formatting to one camp but the formatting have to be partial.
Try to explain:
i have record such as: john.eat.the.apple
i've tried with this code:

if instr({@mycamp}, "john") <> 0 then
crRed
else
crBlue

it works but he put the color in the entire record.

I need that if camp contains "john", only this last is coloured such as:

john.eat.the.apple

Thank you by now for the answers

Cya
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 07 Jul 2008 at 3:24am
Hi,
The work around is create two formulas.
 
frm1
 
which will extract John then format field font tab select x+2 against color and enter
 
if instr({@test}, "john") <> 0 then
CrRed
else
CrBlue
 
frm2
Mid({@test},instr({@test},'.')) this will extract the remaining part
.eat.the.apple
 
then create a TextObject and Place the two formulas in them final result
 
john.eat.the.apple
 
Cheers
Rahul
IP IP Logged
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Posted: 07 Jul 2008 at 5:16am
Sorry Rahul so the entire content of the text obj is:

{@test},instr({test},'.')-1

if instr({@test}, "john") <> 0 then
    crRed
else
    crBlue

{@test},instr({@test},'.')


Is correct (also syntax?)

And not understood what you mean with:

then format field font tab select x+2 against color

How and where can i set that?

I'm sorry i'm a newby of CR

Thnx for answer

Edited by nalfein - 07 Jul 2008 at 5:30am
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 07 Jul 2008 at 6:37am
then format field font tab select x+2 against color 
 
what I meant is when you place the formula frm1 in the report you will get John as value for that formula
 
right click then select format field
then select font tab then in that select X+2 against the color option
 
entire content of text object is frm1 and frm2
 
let me know
 
 
cheers
Rahul
 


Edited by rahulwalawalkar - 07 Jul 2008 at 6:37am
IP IP Logged
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Posted: 07 Jul 2008 at 7:04am
Ah k found myself [IMG]smileys/smiley1.gif" align="middle" />

Another question (2 really)

How can i create the two formula fields? (Step by step)
How can i merge them into a text object? (That i know how to create but not where i have to put the both formulas hehe)

Sorry but i have a report created and i'm learning day basis something new hehe

Edited by nalfein - 07 Jul 2008 at 7:06am
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 07 Jul 2008 at 7:14am
Hi
Open the report ----- the select Menu View---Field Explorer Where you will see the X+2 formula fields  Node Right-Click on it  select New  Enter formula nam a new Formula workshop edior will open enter the formula code in the windows this way you create formulas. Check for syntax errors X+2 in formula editor before saving....
 
Once you create them they will appear in X+2 formula fields  Node drag and place them in the report where you want them.
 
in your case create a text object and place in details section ,just drag the formulas in the text object frm1 first then frm2.
 
cheers
Rahul
IP IP Logged
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Posted: 07 Jul 2008 at 7:30am
Ok so summary:

Form1
({@test},instr({@test},'.')-1)

if instr({@test}, "john") <> 0 then
CrRed
else
CrBlue

Form2
({@test},instr({@test},'.'))

Text obj
{Form1}{Form2}

Is correct?

But when i check (x+2) the field of 1st form the "," is signed and this error message appears:" The ) is missing"

Why?
IP IP Logged
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Posted: 07 Jul 2008 at 8:28am
Ok got it hehe

Last question

If i want to make

John.eat.the.apple

I imagine that i have to create a 3rd formula

I have done that in the same way as the form1 but the result is
John.eat.the.apple.apple
I have to leave the 1st apple from the center

Know how?

Tnx for previuos help (was great)and for nex answer (if you can )

[IMG]smileys/smiley1.gif" align="middle" />

Edited by nalfein - 07 Jul 2008 at 8:29am
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.031 seconds.