0
votes

using Crystal Report 7

I want to display '-' instead of 0, i created a formula like this

if {pay_latecomededuct.upto15d} = 0 then
  '-'
else
  {pay_latecomededuct.upto15d}

the above formula is showing error as "A string is required here"

If i change the numeric instead of '-', not showing any error, even i tried with totext / tonumber also, result is same...

How to solve this problem.

Need Crystal report help

2
You're formula is not allow to return two data types.craig

2 Answers

1
votes

You formula needs to return a consistent value. In this situation, that would be a string.

Add the following to the field's Display String formula:

If {pay_latecomededuct.upto15d} = 0 Then
  '-'
Else
  ToText({pay_latecomededuct.upto15d})
1
votes

Rather try formatting the field.

Right Click and choose Format Field

On The Number Tab click Customize

In the Custom Styles Window, click the Number Tab

Look for the option Show Zero Value as and change it from Default Format to -