IsEmpty or IsNull or IsNothing?

15,419

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).

Share:
15,419
James Craig
Author by

James Craig

Lead QA. I love testing - actually I love breaking things! Working on processes and procedures while trying to keep a bimonthly SP on schedule Starting to get to know ZAP from OWASP. Always looking for part-time projects as well. Working on an App (my java ability is pathetic) in my spare time.

Updated on June 04, 2022

Comments

  • James Craig
    James Craig about 2 years

    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?