Micro Focus QTP (UFT) Forums
dtGlobalSheet Columns - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: dtGlobalSheet Columns (/Thread-dtGlobalSheet-Columns)



dtGlobalSheet Columns - Jackomcnabb - 12-23-2008

Is there a way to search the Gobal sheet and verify that a Column exists?

and if it does not I would need to add a column


thanks


RE: dtGlobalSheet Columns - Ankur - 12-23-2008

Yes. Use
Code:
GetParameterCount
method to get the total no of columns. Loop through all the columns to check for the existence. If it is not found add a parameter (column) using
Code:
AddParameter
method.


RE: dtGlobalSheet Columns - Jackomcnabb - 12-23-2008

[quote=Jackomcnabb]
Thanks a lot.

I had a datasheet with two Columns (Col1 & Col2) and I need to verify that if there was not a Col3 to add to to my script so when it is called later the call would not fail

Code:
a=DataTable.GetSheet(dtGlobalSheet).getparametercount
For i=1 to a
b=DataTable.GetSheet(dtGlobalSheet).GetParameter(i).Name
Next
If b <> Col3  Then
DataTable.GetSheet(dtGlobalSheet).AddParameter "Col3","Test this "
End If
Test1=DataTable("Col3", dtGlobalSheet)

msgbox(Test1)