Save DataStore from debugger

Share this topic:



Link to this posting

Postby Ursego » 19 Feb 2013, 21:37

Data, contained in a DataStore, can be saved as an Excel file when you are debugging. For that, insert a new Watch with the following expression (change ids_XXX to of your real DS):

Code: Select all
ids_XXX.SaveAs("C:\aaa_" + String(Today(), "yyyymmdd") + "_" + String(Now(), "hhmmss") + ".xls", Excel!, true)

Data will be saved:
1. Immediately after you have created the Watch.
2. Each time the script is executed while the application is in the debug mode.
As you see, the name of the created file contains the current date and time, so you don't have to delete the existing file to prevent failure when the DataStore's data is saved next time. You can also save it as a text file:

Code: Select all
ids_XXX.SaveAs("C:\aaa_" + String(Today(), "yyyymmdd") + "_" + String(Now(), "hhmmss") + ".txt", Text!, true)

The last argument, passed to SaveAs(), manages displaying of columns' headers in the first line of the created Excel/text file. Pass true ("display headers") if you want to open the file and have a look on the data, but if your intent is to import the file into a DataWindow, then pass false to prevent an import error (the header will be interpreted as the first row of data).
User avatar
Ursego
Site Admin
 
Posts: 112
Joined: 19 Feb 2013, 20:33

Return to Tips and Tricks

Who is online

Users browsing this forum: No registered users and 1 guest


Save DataStore from debugger

Share this topic:


If you think that this site is not too bad, please LIKE it in Facebook. Thanks!





cron
free counters

eXTReMe Tracker