Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formating in a Formula Post Reply Post New Topic
Author Message
Tsilatipac
Newbie
Newbie
Avatar

Joined: 16 Feb 2010
Location: United States
Online Status: Offline
Posts: 3
Quote Tsilatipac Replybullet Topic: Formating in a Formula
     Posted: 08 Mar 2010 at 12:13pm
Hi all. I'm fairly new to crystal reports. I am building a report and need to change fonts in the formula editor. Can anybody help with this. It should be fairly simple but I cannot id the functions and syntax. What I want to do is   use wingdings Chr(168)+ Arial Chr(XXX)+Wingdings Chr(168) etc. Below the else statement doesn't work because "______" is not a wingdings char string. Any help is appreciated!
=========

if {Qdefs.QF1} = "YES" then
   Chr(168)+Chr(168)
Else
"__________"


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Mar 2010 at 12:26pm
Not exactly sure what youa re doing here but one way I have handled Check boxes is to create the Wing Dings Formula as its own formula for for an emopty box or a checked box ...
if {Qdefs.QF1} = "YES" then
   Chr(254) else Chr(168)
Then I add a text box with the rest of the text I want using Arial then drop the formula field into the text box and change the font for that formula field only to WingDings
IP IP Logged
Tsilatipac
Newbie
Newbie
Avatar

Joined: 16 Feb 2010
Location: United States
Online Status: Offline
Posts: 3
Quote Tsilatipac Replybullet Posted: 08 Mar 2010 at 1:42pm
Thanks, DBlank. What I am doing may be unusual. I'm not just trying to create a conditional check box.

The question I need answered is, "Is there a way to assign/change the font in a formula?"

In the example given, under one condition the field needs to be Wingdings, under another condition it needs to be Arial. I might even have occasion to have arial, wingdings, webdings, etc all concatenated into one string.

Edited by Tsilatipac - 08 Mar 2010 at 1:42pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Mar 2010 at 1:58pm

I do not believe formulatically you can do this back and forth in the same string (...maybe in .NET but I do not use that). What you can do is create a text box and insert different formula fields and apply a different font to each of those. You can make your formula fields return balnks when you want to suppress that portion of the string.

So you break this ....
if {Qdefs.QF1} = "YES" then
   Chr(168)+Chr(168)
Else
"__________"
....
into 2 portions.
Formula1=
if {Qdefs.QF1} = "YES" then
   Chr(168)+Chr(168)
Formula 2 //
if {Qdefs.QF1} <> "YES" then
"__________"
Make a Text String.
Drag and Drop Formula 1 into it and apply WINGDINGS to just that part of it (not the whole text string).
Drag formula 2 into it and apply ARIAL to that part only.
IP IP Logged
Tsilatipac
Newbie
Newbie
Avatar

Joined: 16 Feb 2010
Location: United States
Online Status: Offline
Posts: 3
Quote Tsilatipac Replybullet Posted: 08 Mar 2010 at 2:14pm
Brilliant!! That is exactly what I needed. Thank you.   
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