Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Column Names in DataTable within QTP
#1
Solved: 10 Years, 9 Months ago
Hi,

I was trying use the below code to set values in DataTable

Code:
DataTable("A", Action1") = 2010
But i am getting error "The set DataTable.Value operation failed. The <A> column does not exist."

When i renamed this column it worked.
Is it the displayed column names in the DataTable are not really the column names like in excel sheet??? Because when i renamed this column to "A" (which was already getting displayed in DataTable) it worked.
Reply
#2
Solved: 10 Years, 9 Months ago
Datatable columns can not be said as columns as we say in the excel.
In QTP we say it - 'Parameter'
Datatable will set a value in any of the column that you see there until it is specified as parameter
refer Parameterization in QTP help for more details

Reply
#3
Solved: 10 Years, 9 Months ago
I had an issue where I was missing, as I was running the same code for a number scripts and I built columns on the fly if they where missing, this maybe or not helpful:

Code:
ColNums=DataTable.GetSheet(dtGlobalSheet).getparametercount
For i=1 to ColNums
ColName=DataTable.GetSheet(dtGlobalSheet).GetParameter(i).Name
Next


If ColName <> Col3  Then
DataTable.GetSheet(dtGlobalSheet).AddParameter "Col3","Test this Col 3"
End If
If  ColName <> Col4  Then
DataTable.GetSheet(dtGlobalSheet).AddParameter "Col4","Test this Col 4"
End If

Test1=DataTable("Col3", dtGlobalSheet)
Test2=DataTable("Col4", dtGlobalSheet)

msgbox(Test1)
msgbox(Test2)
Reply
#4
Solved: 10 Years, 9 Months ago
thanks jackomcnabb. It definately helped.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT issues with Outsystems dynamically generated Id/names jherron 2 1,122 03-02-2020, 09:33 PM
Last Post: Swishy70
  [UFT] Get column name from SfwObject felino 0 2,896 12-02-2015, 04:07 PM
Last Post: felino
  AddParameter method does not add in first column of datatable alpha1 4 5,305 07-14-2015, 12:44 AM
Last Post: supputuri
  Comparing two excel Sheets whose columns names vary Divya Roopa 2 8,263 03-26-2014, 07:20 PM
Last Post: Parke
  Unable to right click column header sudhirzpatil 4 6,069 07-18-2013, 09:42 PM
Last Post: sudhirzpatil

Forum Jump:


Users browsing this thread: 1 Guest(s)