Reputation: 1557
I am running powerbuilder 11.2 and trying to debug an operation that pulls data from a text file into a datastore. I can set a watch on the datastore and see information about it, but I want to see the actual contents of the datastore. I have seen some suggestions of adding an expression to the watch window and I inserted the following command:
[datastore].saveas("c:\test\[datastore].xls", xls!,true)
into the watch window but all I got was a circle with a line through it in red. I checked the directory and nothing was saved. I haven't done PB development in a long, long time and this was assigned to me because I did PB development before. So, how can I dump the contents of a datastore in debug mode? Any and all help is so very much appreciated.
Upvotes: 1
Views: 1877
Reputation: 21
You might find it helpful. The link explains how to access data from different buffers.
Anytime during debug you see the red circle in watch window where you evaluate expression, that means your app crashed already. You have to restart debugger.
Better use TRY CATCH statement (and that does not prevent from crashing in debugger i guess).
Upvotes: 0
Reputation: 970
The SaveAs is not a debugger watch expression. You have to add it to your code and put a breakpoint on the line following it. When it hits the breakpoint, open the file in Excel.
Upvotes: 0
Reputation: 11465
Yes the saveas()
tip is a quick way to check what is in a datastore.
But you do not have to add the expression in a watch (because it is likely to replace the data each time the watch is evaluated, or to crash if the datastore is not valid) but in the "quick watch" dialog.
retrieve()
or importString()
)yourdatastore
in the expression field by yourdatastore.saveas("c:\temp\somefile.xls", excel5!, true)
then click "reevaluate"1
. -1
tells there is a problem, like a wrong path or the result file already opened (locked).You can also use text!
instead of the excel5!
value to see the data if Office is not installed in that box. excel5!
is a pretty old format that is widely known by viewers, but excel8!
or xlsx!
(after PB11.5.1) is equally acceptable.
Upvotes: 2
Reputation: 2397
If your location to write the file is c:\test the syntax is "c:\test\"
So the proper entry in the watch window would be:
ids_mydata.saveas("c:\test\mydata.xls", Excel!, true)
This saves the data currently in the 'ids_mydata' datastore to an Excel file named 'mydata.xls' in the folder 'test' on your C drive.
Upvotes: 1
Reputation: 524
You have a syntax error in your expression. Save as type Excel must be Excel!
or XLSX!
.
Saving as Excel 2007 and later (requires .NET 3.5 or later):
[datastore].saveas("c:\test[datastore].xlsx", xlsx!,true)
Saving as Excel format:
[datastore].saveas("c:\test[datastore].xls", Excel!,true)
Upvotes: 0