JetJack
JetJack

Reputation: 988

How to show the string value instead of blank fields

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

Upvotes: 0

Views: 6812

Answers (2)

craig
craig

Reputation: 26262

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})

Upvotes: 1

Adriaan Stander
Adriaan Stander

Reputation: 166476

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 -

Upvotes: 1

Related Questions