Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SaveAsAscii() Functions Returning -1???

Status
Not open for further replies.

kaul125

Programmer
Jan 29, 2002
87
US
I'm trying to use the dwc.SaveAsAscii() function in PB 6.5. However, it always returns a -1. Also, it creates an empty file. In PB help it just states if an error occurs, the function will return a -1. However, what does this -1 mean? I'm unable to find anywhere what the -1 means.

When I use the SaveAs() function, I get no error and it produces an file with the data in it.

Keith
 
Hi Kaul,

SaveAsAscii() is a datawindow function and not datawindowchild function. I think you are trying to use it for a child datawindow of a composite report. If that is the case then make another datawindow object on the window (tabular etc. and not composite) which is same to child datawindow of the composite( of course keep it in non display mode). After it use SaveAsAscii() function.

bye [bigcheeks]
Shantanu
 
As far as I can tell, the datawindow is of SQL Select DataSource and a Tabular Presentation Style. I am using a DDDW as one of the columns in the DW. Will this cause the problem? I am using this function on a datawindow and not a datawindow child.

The reason I'm using SaveAsAscii() is because I have computed columns on this datawindow. Is there another way to get the values of the computed columns(i.e. - all columns visible to the user)

Is there a way to determine the datasource/presentation style through dwc.Describe()?

What do you mean by non display mode?

Keith

 
Kaul125,

DDDW columns do not cause errors while doing a SaveAsASCII(). If you want to save the datawindow exactly as it appears, use the SaveAs() function and save it in the format of Powersoft Report (PSReport!). However, for the users to open PSR files, they need either a tiny PSR Viewer (that you can create yourself) or InfoMaker installed on their machines. For more info on PSR Viewer, surf to:


To know the presentation-style of a dw, query its Processing attribute:

dw.Object.DataWindow.Processing
dw.Describe( "DataWindow.Processing" )

Return values are:

0 — (Default) Form, group, query, or tabular
1 — Grid
2 — Label
3 — Graph
4 — Crosstab
5 — Composite
7 — RichText

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
________________________________
Quoting PowerObject's post
________________________________

Or you can simply export the syntax of the dw at design time & look for the text "processing"

Example:
datawindow(units=0 timer_interval=0 color=16777215 processing=1 print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no grid.lines=0 )
 
A PSR file created vis SaveAs from a datawindow can be displayed in a PB application by setting another datawindow's dataobject property to the PSR file name.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top