Saves the contents of a DataWindow or DataStore in the format you specify.
For syntax to save the contents of graphs in DataWindows and DataStores, see SaveAs.
integer dwcontrol.SaveAs ( { string filename, saveastype saveastype, boolean colheading } )
Argument |
Description |
---|---|
dwcontrol |
A reference to a DataWindow control, DataStore, or child DataWindow. |
filename (optional) |
A string whose value is the name of the file in which to save the contents. If you omit filename or specify an empty string (""), the DataWindow prompts for the filename. |
saveastype (optional) |
A value of the SaveAsType enumerated datatype specifying the format in which to save the contents of the DataWindow object. For a list of values, see SaveAsType. |
colheading (optional) |
A boolean value indicating whether you want to include the DataWindow’s column headings at the beginning of the file. The default value is TRUE. This argument is used for the following formats: Clipboard, CSV, XLS, and TXT. For most other formats, column headings are always saved. |
Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, SaveAs returns NULL.
If you do not specify any arguments for SaveAs, PocketBuilder displays the Save As dialog box. A drop-down list lets the user specify the format of the saved data.
If you use date formats in your report, you must verify that yyyy is the Short Date Style for year in the Regional Settings of the user’s Control Panel. Your program can check this with the RegistryGet function. If the setting is not correct, you can ask the user to change it manually or to have the application change it (by calling the RegistrySet function). The user might need to reboot after the setting is changed.
When you save the contents of a DataWindow to a text file, double quotes are handled in a way that enables the ImportFile function to produce the same DataWindow when the text file is imported back into PocketBuilder. Any field that is enclosed in a pair of double quotes is wrapped with three pairs of double quotes in the saved text file. Double quotes at the beginning of a text field that have no matching double quotes at the end of the field are also replaced by three double quotes in the saved text file. However, a double quote elsewhere in the field is saved as one double quote.
This statement saves the contents of dw_History to the file G:\INVENTORY\EMPLOYEE.HIS. The saved file is in CSV format without column headings:
dw_History.SaveAs("G:\INVENTORY\EMPLOYEE.HIS", & CSV!, FALSE)
Copyright © 2004. Sybase Inc. All rights reserved. |
![]() |