Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Null Values

Hi All,

I am currently having an issue with null values. I wanted to change the blank label for the null group to something like <NULL> and the values for the null group to the right ones rather than 0.

To change the label for the null group I used:

if IsNull({Main.txtCategory2}) then

"<NULL>"

else

{Main.txtCategory2}

This worked fine. So now I just needed to change the 0's to the correct count

I found the option 'Convert Database NULL Values to Default' this then changed all the 0's to the correct numbers, but at the same time changed the label "<NULL>" to blank again.

My question is. How do I have the correct values on count for null fields but also change the blank label. I seem to be able to only have one without the other.

I hope this all makes sense!

Thanks,

Scott

replied

If you have 'convert null values to defult' then a null stgin in the database (which is what you had before) will no longer be 'null'.

Try changing the condition in your formula to test the length of the string field that should represent the name of the group.

ie:

if len({your text field]) < 1 then "<NULL>"

I woudl also recomend that you use caution when setting that global flag to convert null DB values to default values. It can do odd things, like this.

What I do to resolve issues like the one you originally described is to create formulas for fields where I need to convert nulls to explicit values, so I can control what that value actually is. You do need to set the 'default values for nulls' option at the FORMULA level, but then you're explicitly handling a condition, and not just globally finding all nulls, and replacing them with some default value.

For more information on default values, there is actually a really great entry in the crystal help files that explains what Crystal does with nulls in specific field types when that option is checkd. Searching for "Default Values for Nulls" should give you the article I mean.

Hope that helps.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question