Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IsEmpty or IsNull or IsNothing?

Tags:

vbscript

qtp

Can someone help me determine which I should be using?

Here is the situation - I am pulling a value from a column in the Data Table. If there is anything in that column, I set the data to a variable and take an action. If the column is blank, I want to skip that.

I am confused as to which IsWHATEVER statement would be best. For Example:

If IsEmpty(Datatable.Value("M4","Data_Entry"))=False Then

OR

If IsNull(Datatable.Value("M4","Data_Entry"))=False Then

OR

If IsNothing(Datatable.Value("M4","Data_Entry"))=False Then

Suggestions?

like image 976
James Craig Avatar asked Jun 26 '26 00:06

James Craig


1 Answers

I've just tried all of your options and found this to be the most correct:

If (DataTable.Value("M4","Global") <> "") Then

Your original options will not work on QTP Datatables as these are for uninitialised objects or variables. However, in QTP as soon as you create a parameter in the Datatable the first value gets initialised as blank (not to be confused with empty).

like image 117
shreyansp Avatar answered Jun 30 '26 22:06

shreyansp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!