Siebel VB Language Reference > Methods Reference for Siebel VB > Variable Manipulation Methods >

Set Variant Variable to Null Method


The Set Variant Variable to Null method sets a variant variable to a value of Null. It returns a variant that is set to NULL. Note that Visual Basic sets a variant to the empty value, which is different from the Null value.

Format

variableName = Null

The Set Variant Variable to Null method does not include arguments.

Example

The following example calculates the average of ten test score values. If any score is negative, then it sets this value to Null. Before this example calculates the average, the IsNull statement reduces the total count of scores to only those scores that are positive values:

Sub Button_Click
   Dim arrayvar(10)
   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
      Else
         arrayvar(x) = tscore
         total = total + arrayvar(x)
      End If
   Next x
   Do While x <> 0
      x = x - 1
      If IsNull(arrayvar(x)) = -1 then
         count = count - 1
      End If
   Loop
   msgtext = " The average (excluding negative values) is: "
      msgtext = msgtext & Chr(10) & Format (total/count, "##.##")
End Sub

Related Topics

Is Variable Null Method
Is Variable Set Method
Get Variant Type Method

Siebel VB Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.