Print Page | Close Window

How to use Sum which has value hyphen "-"

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=22626
Printed Date: 28 Apr 2024 at 11:25pm


Topic: How to use Sum which has value hyphen "-"
Posted By: dax007
Subject: How to use Sum which has value hyphen "-"
Date Posted: 14 Jun 2018 at 6:12am
Hello,
I'm using following to display play hyphen "-" if the value is NULL

If isnull {Command} then
'   -'
else
ToText ({command} ,1)

This works just fine,but I want to sum of that group and if the group has only one row which is null then that that value display blank instead I want it that as hyphen "-"
For example:

AAA
A111      -
Total AAA
BBB
B111      -
B112      10
Total BBB 10

As you can see from above example "Total AAA" show just blank instead I want it to display - (Hyphen)

Any suggestion?

Thank you




Replies:
Posted By: DBlank
Date Posted: 14 Jun 2018 at 7:42am
is there a difference, for your data purposes, between 0 and null? or a SUM=0 vs. all NULL values for the group?


Posted By: dax007
Date Posted: 14 Jun 2018 at 8:13am
Thanks for your reply. That's the requirement, users wanted to display "-" instead of "0" if it is NULL.
But when I add up the values creates issue when it's "-"

Thanks again..


Also I tried some thing like

Leave the datatype for the column value to Number. Then setup a new formula to display hyphen if the value is null. Then for total use the following formula

If ISNULL ({RTotal0})

Then

' -'

Else

TOTEXT ({RTotal0},1)

When I validate it does not give me any error but when It "Save and Close" it gives me following message.

"A Number, Currentcy ammount, data, time, or date-time is required here."

Any help? Thanks..



Print Page | Close Window