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?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / ravi bandaru
Function isParameterExists(sheetName, paramName)
isParameterExists = FALSE
ParamTotal = DataTable.GetSheet("Global").GetParameterCount
For i = 1 To ParamTotal
value = DataTable.GetSheet("Global").GetParameter(i).Name
Msgbox value
If strComp(paramName,value)=0 Then
isParameterExists=TRUE
Exit Function
End if
Next
End Function
'Example:
If isParameterExists("Global","hh") then
msgbox "Patameter exists"
Else
msgbox "Patameter does not exist"
<Your statements>
End if
| Is This Answer Correct ? | 8 Yes | 2 No |
Answer / nani4urs
Hi ravi Please run above sript in qtp.
is it works?
| Is This Answer Correct ? | 3 Yes | 6 No |
Answer / garywu
Public Function existColumn(byval Sheetname,byval ColumnNum)
paramcount = DataTable.GetSheet
(Sheetname).GetParameterCount
If ColumnNum>paramcount then
existColumn=False
else
existColumn=True
End If
End Function
| Is This Answer Correct ? | 1 Yes | 6 No |
Answer / rajaputra
Try for this,
Val = DataTable("UserId", dtGlobalSheet)
If val=false Then
msgbox "Parameter does not exist"
Else
msgbox "Parameter exists"
End If
| Is This Answer Correct ? | 2 Yes | 12 No |
Some time when i wanna learn the object i face issue like i am not able learn the object in proper manner... eg:for text bo on web page it should learn as webedit but some times it reads as winobject:internetexpoler-server, because of this i have to uninstall the qtp and re-install it again when i do this it reads the object perfectly.....plz suggest the soln
Can anybody help me for vb script in qtp? give me examples for practice plz.
After creating testcases, how do you start testing in QTP? what methodology will follow?
7 Answers Actran, American Well,
What are the differences between quicktest professional and winrunner?
What is iteration? How it is related to Test Results in QTP
3 Answers Virinchi Technologies,
When there is descriptive programming, why do we go for Object repository for desigining scripts.?? why cant we use descriptive programming instead of using the Object repository..??
4 Answers DST Global Solutions,
Hi, this is venkatesh. Q: I have 10 files in a folder(say D:\). Out of which there are some .txt, .xls, .doc. I want to know how to get the count of each file using qtp? If U have any ans, plz write script for that...
what is profile tool?
What is test automation framework?which framework does QTP follow?Need some practical explanation as to how u will start ur testing process following a particular framework?
What is the concept of firewalls?
HoW to open QTP in Real time.after getting the qtp window how to log in .pl answer real time people
I am in need of some set of QTP FAQ @ interview. Also recently in one of interview portal they asked me how you write the script for Login application which it is web -based and using Descriptive Programming? Without associating the shared object repository?Please i do need this answer very soon? Please respond me soon @ vaisu72@yahoo.com