B VBScript09
B VBScript09
Session 9
Dani Vainstein 1
What we learn last session?
Dani Vainstein 2
Subjects for session 9
Conversion functions.
OS Conversions
Asc, Char
Data Types conversions
CBool, CByte, CCur, CDate, CDbl, Char, CInt, Clng,
CSng, CStr
Base Conversions
Hex, Oct
Dani Vainstein 3
Conversion Functions
OS Conversions - Asc
Dani Vainstein 4
Conversions Functions - Char
Dani Vainstein 5
Conversion Functions
Data Type Conversions - CBool
Dani Vainstein 6
Conversion Functions
Data Type Conversions - CByte
Dani Vainstein 7
Conversion Functions
Data Type Conversions - CCur
Dani Vainstein 8
Conversion Functions
Data Type Conversions - CDate
Dani Vainstein 9
Conversion Functions
Data Type Conversions - CDate
Dani Vainstein 10
Conversion Functions
Data Type Conversions - CInt
Dani Vainstein 11
Conversion Functions
Data Type Conversions - CLng
Dani Vainstein 12
Conversion Functions
Data Type Conversions - CSng
Dani Vainstein 13
Conversion Functions
Data Type Conversions - CStr
Dani Vainstein 14
Conversion Functions
Data Type Conversions - CStr
Dani Vainstein 15
Conversion Functions
Base Conversions - Hex
Dani Vainstein 16
Conversion Functions
Base Conversions - Oct
Dani Vainstein 17
Variables Subtypes
Verification
Dani Vainstein 18
Variables Subtypes Verification
IsDate Function
Dani Vainstein 19
Variables Subtypes Verification
IsEmpty Function
Dani Vainstein 20
Variables Subtypes Verification
IsNull Function
Returns a Boolean value that indicates whether an expression contains no valid data
(Null).
IsNull returns True if expression is Null, that is, it contains no valid data; otherwise,
IsNull returns False.
If expression consists of more than one variable, Null in any constituent variable
causes True to be returned for the entire expression.
The Null value indicates that the variable contains no valid data.
Null is not the same as Empty, which indicates that a variable has not yet been
initialized.
It is also not the same as a zero-length string (""), which is sometimes referred to as
a null string.
Caution Use the IsNull function to determine whether an expression contains a
Null value.
Expressions that you might expect to evaluate to True under some circumstances,
such as If Var = Null and If Var <> Null, are always False.
This is because any expression containing a Null is itself Null, and therefore, False.
Dani Vainstein 21
Variables Subtypes Verification
IsNumeric Function
Dani Vainstein 22
Variables Subtypes Verification
IsObject Function
Dani Vainstein 23
Lab 9.1
In a company we have 3 divisions : “HR”,”R&D” and
“QA”
Each employee in each division, will asked by his
name and Salary (Input box) title of input boxes the
division name.
The program will loop in a fixed for…next statement
(for divisions).
Employees will be entered in another loop,
# of employees in each division = unknown.
The default salary is 2800 NIS.
Verify if the entered value for salary is a number,
otherwise display a warning message + warning
icon, and downgrade to zero.
Use only two arrays.
Dani Vainstein 24
Lab 9.1
Write a Sub procedure that outputs to the reporter the
percenatge of taxes paid by each employee according to the
follow tax table
Until 2800 NIS – 0%
Between 2801 And 3500 NIS – 10%
Between 3501 And 4500 NIS – 20%
Between 4501 And 6500 NIS – 30%
Between 6501 And 9500 NIS – 40%
Between 9501 And 12000 NIS – 50%
Between 12001 And 15000 NIS – 55%
15001 and above – 60%
The calculation Itself will be calculated in the function
GetTax(curSal).
Tips :
Use the Erase statement to reuse the arrays.
Convert to subtype currency.
Dani Vainstein 25
Check if input size is > 0 before enter sub.
Make sure to visit us
Tutorials
Articles
Proikects
And much more
www.AdvancedQTP.com
26