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



I want to check in the data table(Globalsheet) column exist or not through script .If column not ..

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

I want to check in the data table(Globalsheet) column exist or not through script .If column not ..

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

I want to check in the data table(Globalsheet) column exist or not through script .If column not ..

Answer / nani4urs

Hi ravi Please run above sript in qtp.
is it works?

Is This Answer Correct ?    3 Yes 6 No

I want to check in the data table(Globalsheet) column exist or not through script .If column not ..

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

I want to check in the data table(Globalsheet) column exist or not through script .If column not ..

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

Post New Answer

More QTP Interview Questions

I am struggling to understand QTP more from descriptive programming point of view. Is it easy to learn good QTP in South india by good faculty than north india? I found a great lack of institution in here. can you suggest me better instituion. I am holding two years of experience in same company, is there possibility in south india for me?

1 Answers  


what is recovery manager and recovey scenerio?

2 Answers   BirlaSoft,


How we test the logo or images in the web page using QTP? For example take google page, they change their logo for new year,christmas etc..How we test that? Plz answer this question... Thanks in advance..

2 Answers  


How to Set the Global Sync Timeouts in QTP?

2 Answers  


HOW TO DO THE BATCH TESTING USING QTP?

8 Answers   CTS,


What are Add-ins availble in licensed version QTP8.2

1 Answers   TCS,


What is exact difference between “while” and “do while” in QTP ?

1 Answers  


My company has recently started using Ajax for building UI and QTP is nor recognizing the drop down list for selection.It recognises it as a general Web Element or Web Table. I have added individual selections from the drop down as web Table. It works as long as the page is not refreshed. I need some help and inputs as to how to make QTP recognise a drop down list for selection. Any help will be appreciated.

1 Answers  


How can the name of a checkpoint be changed in Qtp

2 Answers   Ordain Solutions,


i want to learn testing tools what i have to know before.iam fresher i dnt know any this..which langagues i have to before testing.

2 Answers   Wipro,


plz can any one send me what is Automation Testing Frameworks.. Thanks in advance

1 Answers  


1.what is the extension of action template? 2.what are the strengths and weaknesses of Keyword driven framework? 3.how qtp identify runtime objects?

1 Answers   Satyam,


Categories