Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

What is Curd testing?

0 Answers   Wipro,


How to set the function parameters as optional. Pls anybody can give the answer.. Thanks in advance...

2 Answers   Navis,


waht is the difference between QTP 8.2 and 9.0 version

15 Answers   AppLabs, CTS, Polaris,


1.what is the difference between childobjects and child items in qtp? 2.what is difference between a class and function? 3.can u convert ustimings to indian timings using vbscript? 4.i have scripts in one machine.can i run those scripts in another machine.how?

2 Answers   Genpact, Infosys, Symantic Space, TCS,


What is the file extension of the code file in qtp?

0 Answers  


What is XML checkpoint in QTP. How we can use in Web Based application

2 Answers   LinkEdge,


explain keyword driven framework?

2 Answers   Mindlance,


How to export data present in Datatable to an ".xls" file?

1 Answers   Crea,


Functions call by reference and call by value. i want the diff b/n these 2 and how will be the script for this?in which situation we use these 2..?pls explain me clearly

0 Answers  


How many check points are there in QTP and what are they?

5 Answers  


How can i check all the button that are enabled in a widnows based application ? What script should i write for this ?

1 Answers  


What is iteration? How it is related to Test Results in QTP

3 Answers   Virinchi Technologies,


Categories