Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I change the columnheader(s) in a Datatable ?
#1
Not Solved Question 
How can I change the header of a DataTable column (DTParameter) during runtime ?
I can add a column (DTSheet.AddParameter), get the name of a certain column (DTSheet.GetParameter) and even delete a column (DTSheet.DeleteParameter) but can't find the trick to change column-header.
Any suggestions ?

Paul
Reply
#2
Not Solved
Code:
'add a New Colum
DataTable.GetSheet("dtGlobalSheet").AddParameter "NewColumn","Row1Value"

'copy the cells from the old column into the new column
cnt=DataTable.GetRowCount
For i=1 to cnt
       DataTable.SetCurrentRow(i)
       OldVal=DataTable.Value("OldColumn","dtGlobalSheet")
       DataTable.Value("NewColumn","dtGlobalSheet")=OldVal
Next

'delete the old column
DataTable.GetSheet("dtGlobalSheet").DeleteParameter("OldColumn")
Regards
Reply
#3
Not Solved
Kishore,

thx for the reply.
We already had a similar option in mind, but unfortunately this way of working would be too time-consuming.
Therefor I choose for another way of working :
no longer copy our 'floating' header-definition from within the table to the header, but just read it at the position it is now.

Thanks anyway !

Paul
Reply
#4
Not Solved
Code:
'add a New Colum
DataTable.GetSheet("dtGlobalSheet").AddParameter "NewColumn","Row1Value"

'copy the cells from the old column into the new column
cnt=DataTable.GetRowCount
For i=1 to cnt
       DataTable.SetCurrentRow(i)
       OldVal=DataTable.Value("OldColumn","dtGlobalSheet")
       DataTable.Value("NewColumn","dtGlobalSheet")=OldVal
Next

'delete the old column
DataTable.GetSheet("dtGlobalSheet").DeleteParameter("OldColumn")


Regards
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How do you Change Run mode mid script? Caleytown 6 7,234 03-25-2021, 08:27 AM
Last Post: RB26578
  [UFT] Change property of object (WpfButton) robertosalemi 2 2,628 11-22-2016, 12:43 PM
Last Post: Ankur
  Dynamic change of name for Webtables prakashreddy 1 2,386 10-25-2014, 09:53 PM
Last Post: supputuri
  How can I change my test folders, globally? atester 0 2,029 10-03-2014, 04:37 PM
Last Post: atester
  JavaDialog change every time i run my test Pkapoor 3 2,995 06-28-2013, 09:27 PM
Last Post: Ankur

Forum Jump:


Users browsing this thread: 2 Guest(s)