Print Page | Close Window

formula with return number and string

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2856
Printed Date: 17 May 2024 at 11:08pm


Topic: formula with return number and string
Posted By: huyenhall
Subject: formula with return number and string
Date Posted: 08 Apr 2008 at 10:05am

I have this formula:

If {sort_codes} = "HX03" then {Building_sf}
else
If {sort_codes} = "A001" then {Street_name}
 
It was giving me an error "a number is expected" .
 
Can anyone help me to write this formula that returns both numbers and string?
 
Thanks,
 



Replies:
Posted By: saoco77
Date Posted: 08 Apr 2008 at 10:33am
Don't think you can do that within Crystal.

Listed below are the options to convert one of the two fields to a string or numeric value.

totext({table.field})

tonumber({table.field})

It's likely you'll have to convert the number to a string. Tonumber is generally used when you have a numeric field stored as text.

Hope this helps.

Sarah



Print Page | Close Window