18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> <strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong><br />

Key Notes:<br />

2. If <strong>VBScript</strong> detects that the variant subtype is an Array, the VarType function never<br />

returns 8192. This is a base figure, and the actual value returned is 8192 plus the value of<br />

the array type. For instance, if you have an Array of Boolean values, the value returned<br />

would be vbArray + vbBoolean, or 8192 + 11 = 8203.<br />

IsXxxx() Functions<br />

This is a series of functions that lets you determine whether a specific variable or constant is a<br />

certain data subtype. These functions check the variable or constant against a specific data<br />

subtype and return a Boolean value (True or False) indicating whether the variable or constant<br />

is the specified data subtype. Examples include:<br />

Dim MyArray(5) ‘ Declare an array<br />

Dim MyVal ‘ Declare a variable<br />

Date1 = “April 14, 2006” ‘ Assign Date<br />

Date2 = #6/10/89# ‘ Assign Date<br />

Date3 = “Hello World” ‘ Assign string<br />

MyCheck = IsArray(MyArray) ‘ Returns a Boolean True<br />

MyCheck = IsDate(Date1) ‘ Returns a Boolean True<br />

MyCheck = IsDate(Date2) ‘ Returns a Boolean True<br />

MyCheck = IsDate(Date3) ‘ Returns a Boolean False<br />

MyCheck = IsEmpty(MyVal) ‘ Returns a Boolean True<br />

MyVal = 5 ‘ Assign a value of 5<br />

MyCheck = IsNumeric(MyVal) ‘ Returns a Boolean True<br />

MyCheck = IsEmpty(MyVal) ‘ Returns a Boolean False<br />

MyCheck = IsNull(MyVal) ‘ Returns a Boolean False<br />

MyVal = Null ‘ Assign a null value (contains no valid data)<br />

MyCheck = IsNull(MyVal) ‘ Returns a Boolean True<br />

MyVal = Empty ‘ Assign Empty (uninitialized state)<br />

MyCheck = IsEmpty(MyVal) ‘ Returns a Boolean True<br />

Alternatively, you can use the IsXxxx() function in a conditional statement. For example,<br />

Dim sInput<br />

sInput = InputBox (“Enter a data value”)<br />

If IsNumeric (sInput) Then<br />

MsgBox “Valid Input”<br />

Else<br />

Msgbox “Invalid Input”<br />

EndIf<br />

<strong>InduSoft</strong>, Ltd. 77

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!