Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with a conditional 'Replace'... 3

Status
Not open for further replies.

simmolinho

Technical User
Dec 16, 2003
25
0
0
GB
Hi there,

I'm quite new to CR and have what I hope should(!) be quite a straightforward question...

I am using 8.5 and developing a report from a SQL Server database that is grouped by a 'name' value. The problem I am having is that the field on the DB table can be Null. I wish to change the value in this case to a more meaningful one ie 'Not Assigned' but not alter any of the other values.

Any help would be much appreciated!!

Thanks
 
Use a formual field

If isnull({your.field}) then "Null value"
else {your.field}

Note that Crystal always stops when it encounters a null. This confused me when I first used it: if you test a field for a value and then for null, you get nothing for the nulls because processing stops at the first test.

Madawc Williams
East Anglia, Great Britain
 
Thanks for that!

Please could you advise where to put this formula?

I forgot to say I already have a conditional select on the grouping.

I've created a formula field and placed it in my group header but it creates some strange results,

Cheers
 
You use this formula instead of the actually field and use this in your group header.

Instead of using 'Null Value' you should use 'Unassigned'.

What was the strange results that you got?

Linpro
 
I still can't get this to work!

The strange results are that their is 1 group called "Not Assigned" and 1 called "".

I am expecting it to create groups eg ...

Group1
Group2
Group3
Not Assigned

I also need to only select my group fields dependent on a 'select expert' condition. My group needs to be in Header #1.

Thanks again for your time.
 
try:

If isnull({your.field}) or {your.field} = "" then
"Not Assigned" else
{your.field}

and let me know if that helps....

Reebo
UK

"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."
- Albert Einstein (1879-1955)
 
Thats great, thanks.

Do you know why 'Not Assigned' isn't appearing in the group tree browser though?
 
You could also try using length({your.field}) = 0 then 'unassigned'
 
You will have to add the 'unassigned' to the group at the group header format - instead of using group in ascending order you have to select specific and create unassigned at a new group.

Linpro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top