Micro Focus QTP (UFT) Forums
How to clear the contents of datatable(Local or Global sheet) during runtime? - 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: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: How to clear the contents of datatable(Local or Global sheet) during runtime? (/Thread-How-to-clear-the-contents-of-datatable-Local-or-Global-sheet-during-runtime)



How to clear the contents of datatable(Local or Global sheet) during runtime? - srinibarati - 03-31-2010

Hi,

I have a script and it runs for multiple iterations . For each iteration script will capture some datas from application and the same will be kept in the local or global sheet of runtime datatable and at the end of the iteration captured data will be exported. Before starting the second iterarion I want to clear the contents in the local or Global sheet which is captured in the first iteration. Because sometime in the first iteration 50 rows of data will be there and in the second iteration there will be only 25 rows. If I export the data of second iteration it wll have the first iteration data also in the second 25 rows. So that I want to clear the contents of the datatable for each iteartion so that datatable will have the data for that particular iteration.

I know that I can add the sheet and the same can be deleted after the execution during runtime.

Is there anyway to clear the contents of the runtime datatable?

Regards,
Srini


RE: How to clear the contents of datatable(Local or Global sheet) during runtime? - Saket - 03-31-2010

There is no any direct method for this, you will have to go through each cell in data table and reset it in your script.

what I can think of another way is you can import to the an empty datasheet created earlier as template at the beginning or end of your iteration.


RE: How to clear the contents of datatable(Local or Global sheet) during runtime? - srinibarati - 03-31-2010

Thanks a lot Saket.

As you mentioned I have created a template and using it. Its fine.

Regards,
Srini


RE: How to clear the contents of datatable(Local or Global sheet) during runtime? - EbbyNader - 11-27-2016

All you need is to manually delete the data tables columns, one by one.
1-right click on first column(Example column A).
2-select "EDIT"
3- Select "Delete"