For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Crystal Reports > January 2006 > Summary with NULL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Summary with NULL
Alison Givens

2006-01-30, 7:05 pm

I get no result when I add these variables.
{@SharedBonnen} + {@SharedContract} + {@SharedImproductief} +
{@SharedProject} + {@SharedRelatie}

(VB.Net 2003 with CR.)

The problem is caused by NULL values.
I read in this newsgroup something about If Is NULL then...
but I couldn't get it working.

Can anybody tell me how to do this?

Kind regards,
Alison.




Jay Taplin

2006-01-30, 7:05 pm

You will want to use the "IsNull" keyword (note that this is one word).
For instance:

Dim Value As Number

If Not IsNull({@SharedBonnen}) then
Value = Value + {@SharedBonnen}
End If

If Not IsNull({@SharedContract}) then
Value = Value + {@SharedContract}
End If

....etc.

Jay Taplin [MCP - VB]

Shariq

2006-01-30, 7:05 pm

Alison, If you follow the my posting carefully, that you referenced, it
should work fine as follows:

If IsNull({Field1}) Then
{Field2}+{Field3}+{Field4}+{Field5}
Else If IsNull({Field}) Then
{Field1}+{Field3}+{Field4}+{Field5}
Else If IsNull({HATB.BUKT3}) Then
{Field1}+{Field2}+{Field4}+{Field5}
Else If IsNull({Field}) Then
{Field1}+{Field2}+{Field3}+{Field5}
Else
{Field1}+{Field2}+{Field3}+{Field4}+{Fie
ld5}
"Alison Givens" wrote:

> I get no result when I add these variables.
> {@SharedBonnen} + {@SharedContract} + {@SharedImproductief} +
> {@SharedProject} + {@SharedRelatie}
>
> (VB.Net 2003 with CR.)
>
> The problem is caused by NULL values.
> I read in this newsgroup something about If Is NULL then...
> but I couldn't get it working.
>
> Can anybody tell me how to do this?
>
> Kind regards,
> Alison.
>
>
>
>
>

Jay Taplin

2006-01-30, 7:05 pm

Unfortunately, that solution will not work for a couple of reasons. 1)
In your Else If IsNull(xxx) lines, the "xxx" does not have the valid
field names. 2) If you have more than one field that has nulls, the
formula will still error out (ex. Field1 and Field2 are NULL).

I'd do them all separately, as in my post.

Alison Givens

2006-01-31, 4:11 am

Thanks guys,
I enhanced the formula to this and it works:

If IsNull ({@SharedReisCorrect}) then 0 else {@SharedReisCorrect} + If
IsNull ({@SharedReisDubbel}) then 0 else {@SharedReisDubbel} + If IsNull
({@SharedReisFoutief}) then 0 else {@SharedReisFoutief}

Alison.



"Jay Taplin" <jaytaplin@integraware.com> wrote in message
news:1138651268.612627.144020@o13g2000cwo.googlegroups.com...
> Unfortunately, that solution will not work for a couple of reasons. 1)
> In your Else If IsNull(xxx) lines, the "xxx" does not have the valid
> field names. 2) If you have more than one field that has nulls, the
> formula will still error out (ex. Field1 and Field2 are NULL).
>
> I'd do them all separately, as in my post.
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com