Saves the contents of a DataWindow or DataStore into a standard ASCII text file.
long dwcontrol.SaveAsAscii ( string filename {, string separatorcharacter {,string quotecharacter {, string lineending } } } )
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). |
Returns 1 if it succeeds and -1 if an error occurs.
SaveAsAscii is a cross between the SaveAs (Text!) function and the SaveAs (HTMLTable!) function with additional arguments. It mirrors more closely what the user sees on the screen. Arguments allow the user to control how contents are separated and delimited in the ASCII file.
PocketBuilder assigns a cell for each DataWindow object (which can include computed columns and group totals). If a cell is empty, PocketBuilder puts the quotecharacter between the separatorcharacter in the output file.
This statement saves the contents of dw_Quarter
to the file H:\Q2\RESULTS.TXT. The saved file
is ASCII 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:
dw_Quarter.SaveAsAscii("H:\Q2\RESULTS.TXT","&","'")
Copyright © 2004. Sybase Inc. All rights reserved. |
![]() |