0
votes

I am a newbie to Crystal Reports. There is a Parameter which has 2 values Yes and NULL in the mapped database column. I am trying to create a cross table with count, like -

Name    Yes   NULL
ABC      5     2
XYZ      3     7

How can I display 'No' in place of Null like --- Name Yes No

3
user455580, i am so, so sorry - Jason

3 Answers

4
votes

As Beth suggests, this sort of thing is often easier on the DB (ie. query) side.

If you really want to do it in Crystal, create a new appropriately-named formula, with an expression similar to this:

If IsNull ({TABLE.FIELD}) Then "No" Else {TABLE.FIELD}

and change your crosstab to group on the formula, instead of the TABLE.FIELD value.

1
votes

Substitute No for Null on the db side if you can.

1
votes

Often you don't have control over the data source, such as when reporting against a proprietary program that is using SQL Server on the back end. In those cases you would want to do exactly as Mark suggests.

A further habit which can sometimes make things easier: create a formula called Group1. In it simply put the field name you are grouping on. Then if you do run in to this situation - where you have to swap a formula for the real field to handle NULL, you just have to change the contents of the formula Group1 from {fieldname} to @formulaname.

The big advantage here is that if you have a report where you 've done considerable work - i.e. lots of summaries and other elements added to the Group Footer - you will loose them all if you change the GroupBy from {field} -> @formula. Howver by Grouping on a formula called @Group1 and simply changing its contents, you avoid losing that work.