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

Display Numeric Field

Status
Not open for further replies.

ba4crm

Technical User
Dec 19, 2003
92
US
Hi,
Using CR 8.5:
I am pulling data from a numeric field (Order.Count) where if the field is empty (isnull), I want to display the word "Blank", else display the contents of this field.
I am using:
if isnull({Order.Count})
then "Blank"
else ({Order.Count)
but I keep on getting "A string is required here" error message after "else" in the above formula.

What am I doing wrong?
Thanks in advance.
 
I don't know if you copied the code exactly, but you have missed a curly bracket of the end of the very last field name.
CR shouldn't have a problem displaying numbers - you shouldn't have to convert them or anything, even if you are using a string in another part of the formula.
 
The possible results of a formula must be of the same datatype, so try:

if isnull({Order.Count})
then "Blank" else
totext({Order.Count})

You can format the totext() function like totext({order.count},"0000") to create four digits always (or whatever number you want so that they sort numerically, if that matters) or you can format like totext({order.count},0,"") which would eliminate the decimals (0) and eliminate the thousands separator (,).

If you wanted to keep the number datatype, then change your formula to:

if isnull({Order.Count})
then 0 else
{Order.Count}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top