Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DataTable.GlobalSheet.DeleteRows
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi,

when I use the "Expert View" in qtp and I use auto completion, qtp IDE show me a DeleteRows method on the DTSheet object :

Code:
DataTable.GlobalSheet.DeleteRows
But at runtime it always say that this object doesn't know this property or this method.
So, why does qtp propose that ???

Does someone know how to delete rows in a runtime datasheet ?
Same thing with DataTable.GlobalSheet.Clear...
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi,

Not sure about DataTable.GlobalSheet.DeleteRows. let us know where did u find about the above.

But deletion of columns(fields) is possible.
Syntax : DTSheet.DeleteParameter(ParameterID/Name)
Code:
Example : DataTable.GetSheet("dtGlobalSheet").DeleteParameter("Place")
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi,
I am not sure about deleting rows and columns in datatable. but u can delete the rows and cloumns in external file i.e,
1.Let say u want to import a file c:/file1 (it consists of 10 rows and 5 columns)
2.But u dont need all these data so u might be deleting some rows and some coumns which is the datat u dont require (Ex: c.rows(rownumber).delete, c.columns(coulmn number).delete), here c is an object whichu have to create)
3.Do not save this file , just save as file with file2 (After deleting the rows and cloumns then this might be the required one)
4.Now u can import the file2 in global sheet
5.Perfom the operation as u like.....

Please let me know if u need any code related stuff , try for some time to get the soultion and then let me know about this....

'sreekanth chilam' suggested code is for deleting columns i.e parameters only....
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
>> let us know where did u find about the above.

please look at the capture screen I attached :
[attachment=320]
>> please look at the capture screen I attached :

ok, it seems that the attachment didn't work.
Please just go in the expert view and type :
datatable.globalsheet.

After the last dot the autocompletion box appears with the DeleteRows method in it.
Reply
#5
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Guillaume@cegc
which QTP version you are using? I don't see any method as 'DeleteRows' for global sheet in QTP 10.(refer attachment)


Attached Files Image(s)
   

Reply
#6
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Saket,

I am using QTP 9.5, even I too found this "Datatable.GlobalSheet.DeleteRows" method in IDE.

Refer the attached file for more info.


Attached Files Image(s)
   
Reply
#7
Solved: 10 Years, 8 Months, 3 Weeks ago
strange, I cant see this in QTP 10. Not sure why it has been removed.

Reply
#8
Solved: 10 Years, 8 Months, 3 Weeks ago
I use QTP 9.2.

The best way I found to delete all rows of a sheet is that :

Code:
Public Function ResetSheet(sheetname)
   DataTable.ImportSheet Environment.Value("TestDir") & "\Default.xls", sheetname, sheetname
End Function
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)