Jump to content

Recommended Posts

Posted

Friends,

Some of my queries are returning null values

How can i check whether it is null or not?

Is there any keyword called NULL so that i can compare my value with that keyword to determine whether its null or not

Regards

Posted

Friends,

Some of my queries are returning null values

How can i check whether it is null or not?

Is there any keyword called NULL so that i can compare my value with that keyword to determine whether its null or not

Regards

$Var = 0
MsgBox( 0, "Its null!", $Var)

;or

If $Var = 0 Then
    MsgBox( 0, "Its null!", $Var)
    EndIf
Posted

AutoIt has no NULL keyword.

One method I have used is:

If StringLen($value) = 0 Then
    MsgBox( 0, "$value = ", "Null")
Else
    MsgBox( 0, "$value = ", $value)
EndIf

which works for both string and numeric fields

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Posted

In some cases, you should use IsPtr(0). I also asked this question. See this.

What cases for example?

...anyway, if you need to check if something is not nothing then you would probably do it like this:

$iValue = 0
If $iValue Then
    ;...
Else
    ConsoleWrite("! iValue in not" & @CRLF)
EndIf

$sValue = ""
If $sValue Then
    ;...
Else
    ConsoleWrite("! sValue in not" & @CRLF)
EndIf

$fValue = False
If $fValue Then
    ;...
Else
    ConsoleWrite("! fValue in not" & @CRLF)
EndIf

Or maybe:

If Not $iValue ...

♡♡♡

.

eMyvnE

Posted

Maybe it is a good idea to add another UDF in the SQL UDF's that checks for "NULL" values or just modify the query functions to indicate when they return "NULL" ?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...