Siebel VB Language Reference > VB Language Reference >
This standard VB function sets a variant variable to the Null value.
A variant value set to NULL.
Null is used to set a variant variable to the Null value explicitly, as follows:
Note that variants are initialized by Basic to the empty value, which is different from the Null value.
This example asks for ten test score values and calculates the average. If any score is negative, the value is set to Null. Then IsNull is used to reduce the total count of scores (originally 10) to just those with positive values before calculating the average.
Dim count as Integer
Dim total as Integer
Dim x as Integer
Dim tscore as Single
count = 10
total = 0
For x = 1 to count
tscore = 88
If tscore < 0 then
arrayvar(x) = Null
arrayvar(x) = tscore
total = total + arrayvar(x)
Do While x <> 0
x = x - 1
If IsNull(arrayvar(x)) = -1 then
count = count - 1
msgtext = " The average (excluding negative values) is: "
msgtext = msgtext & Chr(10) & Format (total/count, "##.##")