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


Please Help Members By Posting Answers For Below Questions

How did you resolve conflicts present in Object Repository?

1819


Print the Prime numbers in below format only up to 20(Need commas also) 1,2,3,5,7,9,11,13,17,19

1429


Is there anyway to automatically update the Datasource name in Database Checkpoints object when we migrate tests to a new release?

3555


Hello everyone! I am just writing a small test for a windows application. I have a problem with a text output value. The value i am trying to catch is presented in a scrollable textbox. When the text is too long, only a portion of it gets captured. Do you have any experience with this?

2365


Explain Descriptive Programming Types with Examples?

1161


hi nani my doubt is how does qtp process metrix related to software process.

1769


How to check feasibility of the appliction?in automation testing?

1725


Could any one tell me "How can i recognize my cursor position using QTP 9.2" Give me a scripts for this

2269


how to post xml data from QTP scripts to any application?

1752


What is a recovery scenario?

809


Mention the test steps of qtp.

756


what function you write to do database testing with the help of qtp?

1602


An object is non standard object, i mapped it to standard object, eventhogh on mapping to standard object i cannot use the methods available on the standard object with the mapped object. How i can use those standard object methods with these mapped object. (((Note : dont tell that we can use virtual object as virtual object is to map nonstandard obj to standard obj)))

1823


Write a QTP script to enter a keyword in to Google search engine?

860


i need to add 1000 users in a domain i written the script for that and it is running successfuly but the problem is that my system is not the user of that domain in which i have to add users so for adding users in that domain i have to install qtp on that another system, can anybody suggest me the way to add those users from my system ultimately i want to know how to access remote computer through script

1636