SaveAsAscii – PB Docs 150

SaveAsAscii method (DataWindows)

Description

Saves the contents of a DataWindow or DataStore into a standard
ANSI text file.

Controls

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataStore object

Syntax

[PowerBuilder]

Argument

Description

dwcontrol

A reference to a DataWindow control or
DataStore.

filename

A string whose value is the name of the
file in which to save the contents.

separatorcharacter (optional)

A string whose value is the character
to be used to delimit values. If you omit separatorcharacter,
the default is a tab character.

quotecharacter (optional)

A string whose value is the character
to be used to wrap values. If you omit quotecharacter,
the default is double quote.

lineending
(optional)

A string whose value is placed at the
end of each line. If you omit lineending, the
default is a carriage return plus a newline character (~r~n).

retainnewlinechar (optional)

A boolean value that determines whether
line feed and carriage return characters contained within the row
are converted to white space. Values are:

  • True – line feed and
    carriage return characters within the row are not converted to white
    space

  • False (default) – line
    feed and carriage return characters within the row are converted
    to white space

Return Values

Returns 1 if it succeeds and –1 if an error occurs.

Usage

SaveAsAscii always saves the file with
ANSI encoding. To save to a file with a different encoding, use SaveAsFormattedText.

SaveAsAscii is like SaveAs with
the Text SaveAsType. However, unlike SaveAs, SaveAsAscii formats
the text and saves column headers in the form in which they are
displayed in the DataWindow instead of as the column name. For example,
if the heading for the cust_id column
is Customer ID, SaveAsAscii saves Customer
ID
to the text file, whereas SaveAs saves cust_id. SaveAsAscii also
saves computed fields allows you to customize formats in the file. If
you do not specify custom settings, values are wrapped in double
quotes and separated by tabs. A newline character (~r~n) is placed
at the end of each line. Line feed and carriage return characters
within each row are converted to white space.

PowerBuilder assigns a cell for each DataWindow object (which
can include computed columns and group totals). If a cell is empty, PowerBuilder
puts the quotecharacter between the separatorcharacter in the
output file.

Examples

This statement saves the contents of dw_Quarter
to the file H:Q2RESULTS.TXT.
The saved file uses ANSI encoding with the ampersand (&)
as the separator character, and single quotes (')
as the characters used to wrap values. A new line (~r~n) is automatically
inserted at each line ending. Computed columns are included with
the saved information:

See Also


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x