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

Give me At Least 5 Differences between DOCUMENTATION OBJECT MODEL(DOM)and COMPONENT OBJECT MODEL(COM)? Interviewer said me to WRITE the difference only in points not as you WRITE a paragraph ???? only in points

1625


What are benefits of qtp?

579


I want to capture data(using keyword) from msdos application using QTP?... Below is little work i could do on it... /* Set app=CreateObject("Wscript.shell") SystemUtil.run ("C:\Users\Agent\Desktop\pumpsim\PUMPSIM.EXE") Window(“PUMPSIM.EXE”).Activate wait(3) app.sendkeys "N" */ Thanks in advance...!!!

1435


What is a Patch in QTP?

604


What are the challenges u faced in testing with crm domain? How u overcome with?

1483






How to capture all the data of a webtable, weblist and combolist using QTP?

2852


Is qtp supports uni-code?

610


what is clean sweep?

1881


How many add-ins comes by default with qtp?

537


Can anyone tell me how i used QTP 9.2 use for GIS based S/w with an example?

1684


Explain different types of checkpoints?

560


For example you are checking bit map check point before coming to the results. How can you say it is passed? Or failed? Anyways?

614


How to do the scripting. Is there any inbuilt functions in qtp as in qtp-s. What's the difference between them? How to handle script issues?

527


The hybrid framework can be implemented for any application. Is it true?

585


In qtp, how you can get the last character from a string?

556