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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Bold Formula 2

Status
Not open for further replies.

Jefftopia

Programmer
Jul 30, 2002
104
US
Mission: to create a formula which will set the font style to bold for data where {rptQryMerits.TM_code} = "H"

Problem: getting error-"The formula result must be a number". Do not know why this would be the case since this field either contains a "H" or a "D".

New to CR and appreciate any help on this thx.
 
If you right click on this field in either the design window or the field explorer and select browse data, what values do you see?

Also, please post your formula. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Browse Data Results:

Type: String
Length: 1

D
H

My code:{rptQryMerits.TM_code} = "H"
 
I tried this with a numeric formula and was able to bold conditionally by:

if {rptQryMerits.TM_code} = "0"
then 1
else 0

so I figure

iif({rptQryMerits.TM_code}="H",1,0)

might work for you.

 
that's it. thank you. just wondering were I could find a list of values (1= Bold, 0 = Regular).
 
Good answer, I never knew that about the bold and regular being 1s and 0s. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
You don't normally use the numbers (although they work). Instead the normal arguments are the words listed in the "Format Style Constants" at the top of the function list. The 4 options for this property are:

crRegular (0)
crBold (1)
crItalic (2)
crBoldItalic (3)

So the more common usage is:

if {condition}
then crBold
else crRegular
Any of the non-boolean conditional properties have a list of constants (like colors) that you can pick from. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top