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
Give me At Least 5 Differences between DOCUMENTATION OBJECT MODEL(DOM)and COMPONENT OBJECT MODEL(COM)? Interviewer said me to WRITE the difference only in points not as you WRITE a paragraph ???? only in points
What are benefits of qtp?
I want to capture data(using keyword) from msdos application using QTP?... Below is little work i could do on it... /* Set app=CreateObject("Wscript.shell") SystemUtil.run ("C:\Users\Agent\Desktop\pumpsim\PUMPSIM.EXE") Window(“PUMPSIM.EXE”).Activate wait(3) app.sendkeys "N" */ Thanks in advance...!!!
What is a Patch in QTP?
What are the challenges u faced in testing with crm domain? How u overcome with?
How to capture all the data of a webtable, weblist and combolist using QTP?
Is qtp supports uni-code?
what is clean sweep?
How many add-ins comes by default with qtp?
Can anyone tell me how i used QTP 9.2 use for GIS based S/w with an example?
Explain different types of checkpoints?
For example you are checking bit map check point before coming to the results. How can you say it is passed? Or failed? Anyways?
How to do the scripting. Is there any inbuilt functions in qtp as in qtp-s. What's the difference between them? How to handle script issues?
The hybrid framework can be implemented for any application. Is it true?
In qtp, how you can get the last character from a string?