cruisin
Posts: 31
|
| Posted: 09/13/2007, 7:50 PM |
|
I have a label problem that isn't specific to code charge, but I'm having trouble finding a reference to fix it. Basically I'm changing the label in a listbox (a +' '+ b + ' 'c) as d
which works fine as long as there aren't any null values. If any of the values are null then d is null. It should be possible for a, b, or c to be null but the result should still show the remaining combined value.
Any suggestions?
Thanks,
Rob
|
 |
 |
Edd
Posts: 547
|
| Posted: 09/15/2007, 6:17 PM |
|
Assuming that you are using MSSQL then use the IsNull operator, example
(IsNull(a + ' ','') + IsNull(b + ' ', '') + IsNull(c,'')) as d
You will note that I used
IsNull(a + ' ','')
Instead of
IsNull(a,'') + ' '
Becase if "a" is a null you don't want a space after it.
Hope it helps.
Edd
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
 |
 |
Tuong Do
|
| Posted: 10/09/2007, 5:23 PM |
|
Hi Rob,
You can use the SQL coalesce function to return 0 if the value is null, for
example coalesce(a,0) will never return null
ie
Select coalesce(a,0) + coalesce(b,0) + coalesce(c,0) as d
"cruisin" <cruisin@forum.codecharge> wrote in message
news:646e9f6dbe4d80@news.codecharge.com...
>I have a label problem that isn't specific to code charge, but I'm having
> trouble finding a reference to fix it. Basically I'm changing the label
> in a
> listbox (a +' '+ b + ' 'c) as d
> which works fine as long as there aren't any null values. If any of the
> values
> are null then d is null. It should be possible for a, b, or c to be null
> but
> the result should still show the remaining combined value.
> Any suggestions?
> Thanks,
> Rob
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
|