Link to home
Start Free TrialLog in
Avatar of waltraud2000
waltraud2000Flag for United States of America

asked on

conditional font size for crystal report field

in the formula workshop of Crystal version 9, I am trying to make strings above a certain length a smaller size and different font, something like below, which is obviously wrong.

if ({myfield.ClientName}.length > 40) then
font.size=9
font.style = arialnarrow
end if

Can this be done, and if so, what is the syntax?
Avatar of wykabryan
wykabryan
Flag of United States of America image

No within 9 it can not be done.  What you could do though is create another section below it and conditionally suppress one or the other if the lenght> 40.
Avatar of waltraud2000

ASKER

In this case it is a crosstab, and client will not accept all entries in this field being in a small font. She was willing to accept just one unusually long entry in that small font. My above attempt was supposed to be a workaround for not being able to grow the field in a crosstab.

So I guess there is no way to conditionally change one entry's format within a crosstab in version 9?
No. there is not in 9, 10, 11, or 12(possible).. just to help you out with that..
In 8.5, when I right-click on a field in the report, I can go to Format Field, click on the Font tab, and click the formula button next to font size, name, color or whatever.  If you go into the formula for size, you just need to return the numeric for the size you want, i.e. if (length({ClientName}) > 40 then 9 else 12.  Same thing with the font name, just return a string that matches a font name.
Avatar of Mike McCracken
Mike McCracken

That does work in a crosstab.

Right click the cross tab field
Click FORMAT FIELD
Click the FONT TAB
Click the formula button bext to SIZE
If Length(CurrentFieldValue) > 40 then
8
else
10

Similarly for the font

mlmcc
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Right Cross tab will allow font changes. jgbreeden in the later version there isnt a place for formulas next to the format text font area. (X+2)