Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Font Size if field is more than xx chars?

Status
Not open for further replies.

strom99

MIS
Nov 28, 2000
126
US
Is it possible to change the font size of my following formula field if the description is longer than 40 characters? Or force a return after the chr(153) symbol if the length is longer than 40 characters?

TrimLeft(Replace({sp_pp_header;1.product_description},"(TM)",chr(153)))


Thank You
 
Sure...as long as you have CR 8.0 or higher

You can conditionally set the Font Size...look in Format Editor|font and click on the button to the right of the font size

this conditional formula is a little different from others in that a number ... not boolean is required. An example in your case would be

if length({table.description}) > 40 then
12 else DefaultAttribute;

this would assign your report default font size unless the size of the description was greater than 40 characters then it would be font size 12.


As far as forcing a <return> if a certain character is found then...you must have a formula for that field

@description

Replace ({table.description},chr(153),chr(153) + chr(13) +
chr(10) )

this is a simple way...it searches for chr(153) then replaces it with the same character plus a <return> and <linefeed> (I usually add the line feed not sure if necessary but never hurts)

Hope this helps....Jim
 
Jim,

I cannot find this in my version (developers) of CR 8.5 -- I rt click on my database field, and I can change the font, but not conditionally -- there is no X-2 button available to me.

Exactly how are you doing this? I cannot find a &quot;format editor&quot; option on any menu. I am missing something here. Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
Go up to the menu Format > Font it should be there.

One more question regarding Jim's formula, works great except the second line now has a space as the first character.

Looks like this

Dynamar(TM)
Curative and Bonding Agents

The space shouldn't be there, how can I remove it in the followig formula.

If length({sp_pp_header;1.product_description}) > 30 Then
TrimLeft(Replace({sp_pp_header;1.product_description},&quot;(TM)&quot;,chr(153) + chr(13) ) )


Thanks for the help
 
OK, I am really missing something. Selecting Format-font is nothing new, but I do not have an X-2 button (conditional formatting) to the right of the size drop down listbox.

On the &quot;font&quot; tab, I have choices of font, style, size and color, NONE of which have an X-2 for conditional formatting.

How do I do this? Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
There is no conditional options on inserted text fields like column headers, but there &quot;should&quot; (emphasis on should, I'm giving my example based on what I have access to)be the option to conditionally format a string field from a database. Mike

 
Mike,

Thanks, I got it now. I was trying to do this to a text field. Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
I think your space problem may have to do with the Paragraph formatting on that field...check that out in the format editor

should be zeros in first three values

works for me

another thought is that there is a space after the Chr(153)

in which case your search string should be

Chr(153)+ &quot; &quot; instead of chr(153) by itself

Glad it worked :)...Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top