QTP : DataTables
'Note in QTP COLUMNS ARE CALLED AS "PARAMETERS "
'Setting Row to be operated
'----------------------------------------------------------------------------------
datatable.GetSheet("Global").SetCurrentRow 1
'----------------------------------------------------------------------------------
'Write Data into a cell
'----------------------------------------------------------------------------------
datatable.GetSheet("Global").AddParameter
"A","Hi"
datatable.GetSheet("Global").AddParameter
"B","Bye"
'----------------------------------------------------------------------------------
'Read Data into a cell
'----------------------------------------------------------------------------------
msgbox datatable.GetSheet("Global").GetParameter
("A").Value
msgbox datatable.GetSheet("Global").GetParameter
("B").Value
'----------------------------------------------------------------------------------
'Read Columns and Rows
''----------------------------------------------------------------------------------
msgbox "Row Count
="&datatable.GetSheet("Global").GetRowCount
msgbox "Column Count
="&datatable.GetSheet("Global").GetParameterCount
'----------------------------------------------------------------------------------
'Display Column name
'----------------------------------------------------------------------------------
msgbox "Column 1 Name="&
datatable.GetSheet("Global").GetParameter (1).Name
'----------------------------------------------------------------------------------
'Number of Actions or Datatables
'----------------------------------------------------------------------------------
Msgbox "No of Actions
="&Datatable.GetSheetCount-1
'----------------------------------------------------------------------------------
'Add New Column
'----------------------------------------------------------------------------------
datatable.GetSheet("Global").AddParameter
"xyz",""
'----------------------------------------------------------------------------------
'Datatable in Actions
'----------------------------------------------------------------------------------
RunAction "Action1",oneIteration,Datatable("A","Global") 'A=> 1-2
'----------------------------------------------------------------------------------
No comments:
Post a Comment