I want to check in the data table(Globalsheet) column exist
or not through script .If column not exist only proceeded
to next step Pls tell me how to proceeded?
Answer Posted / drew
Answer 1 is good if you don't have a lot of data to write to
the data table. I sometimes have 20 columns to write to and
to check for the column each time before writing the data
can take 2 or more seconds each (40 seconds for the entire
row)...way to long if doing a repetitive task.
Answer 3 won't work because you will get a QTP error on the
line "Val = DataTable("UserId", dtGlobalSheet)" if the
column doesn't exist. But you can use that error to make a
very speedy function to find out if the column exists:
If COM_DoesDataTableColumnExist("Global","Column1") Then
''Column Exists
Else
''Column Does Not Exist
End If
Public Function COM_DoesDataTableColumnExist(ByVal
strSheetName,ByVal strColumnName)
Dim blnReturnValue
Dim strTestColumn
Err.Clear
On Error Resume Next
strTestColumn =
DataTable.GetSheet(strSheetName).GetParameter(strColumnName).Name
If Err <> 0 Then
blnReturnValue = False
Else
blnReturnValue = True
End If
Err.Clear
COM_DoesDataTableColumnExist = blnReturnValue
End Function
| Is This Answer Correct ? | 21 Yes | 5 No |
Post New Answer View All Answers
wht type of User defined functions or Java Releated functions Do we write in VB scripting
Can you write a script to check if the folder exists or not?
What are the different types of recording modes in qtp? Which will be used when?
what is meant by Implicit and explicit requirements?
What is an expert view and keyword view?
assume i have few url link how will i dynamically call then using descriptive programming?
How will internal and external links be validated and updated? how often?
How is a Step generator used in UFT?
your coming from electrical backgroung..but y ur coming to software side?
What is qtpro? What is quick test pro?
Explain actions in qtp ?
Can anyone help.i need total excelsheet operations,shortcuts in testing environment from starting onwards....
What is difference in global and action sheet in qtp?
How do you create new test sets in td?
How does quicktest professional identifies the object in the application?