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

can we create recorset with out using database connection in vbscript?

1 Answers   CSS, CSS Corp,


How do you invoke any application and write a script to invoke QTP using VB Script.

2 Answers   HealthAsyst,


X flies from Hyd to bangalore using different methods of transportation. write the test scenarios and test cases for this?

0 Answers   Virtusa,


How to give a call to another action from one action?

0 Answers  


How to add a runtime parameter to a datasheet?

1 Answers   Crea,


Hi I am new to QTP. can u please answer to my qus... suppose 3 excel sheets are there * we are trying to check for login credentials for a page. userid from excel1 , password is from excel2 whether the page is opened or not that checkpoint is result is should be stored in excel 3.... this qus i have faced in IBM technical round... please tell script for above query ... please please

0 Answers   IBM,


How many tables r created during the recording in QTP?

2 Answers  


can we run the scripts of qtp 8.2 in the qtp7.0?

2 Answers  


what is Smart identification

1 Answers   Wipro,


WHAT IS ENVIRONMENT VARIABLES?

7 Answers   AZTEC, CTS, Ready Test Go,


If we are record a same web page for 2 times.1st time it is showing 6 objects in the Object Repository and for the 2nd time it is showing like 7 Objects in the Object Repository why it is happening

4 Answers   Kanbay,


Please explain how to open with notepad of saved html file by right click option using QTP

1 Answers  


Categories