of_save


pfcdwsrv.pbl   >   pfc_n_cst_dwsrv_querymode   >   of_save   

Full name pfc_n_cst_dwsrv_querymode.of_save
Access public
Extend of integer
Return value integer
Prototype public function integer of_save(string,ref string,ref string,string,string)

Name Datatype
No Data

Name Datatype
li_fileno integer
li_value integer
ls_data string

public function integer of_save (string as_title, ref string as_pathname, ref string as_filename, string as_ext, string as_filter);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_Save
//
//	Access:  public
//
//	Arguments:
//	as_title   title of the dialog box.
//	as_pathname   string variable whose value is the default filename and
//		which will store the returned	path and filename. The default
//		filename is displayed in the File name box, but the user can specify another name. 
//	as_filename   string variable in which you want to store the returned filename
//	as_ext   1 to 3 character default file extension
//	as_filter   text description of the files to include in the listbox
//		and the file mask that you want to use to select the
//		displayed files (for example, *.* or *.exe).
//
//	Returns:  integer
//	 1 = The save was successful
//	 0 = The user clicked the Cancel button or Windows canceled the display
//	-1 = The save was unsuccessful
//	-2 = The save was unsuccessful due to File I/O errors
//
//	Description:
//	Saves query criteria to disk (query criterias are loaded in "of_Load")
//	This function will not invoke the File Save dialog if the datawindow is not in QueryMode.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1999 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
integer	li_value
integer	li_fileno
string		ls_data

// Verify passed arguments.
if IsNull (as_title) or IsNull (as_pathname) or IsNull (as_filename) or &
	IsNull (as_ext) or IsNull (as_filter) then return -1  

// Check the datawindow reference.
if IsNull(idw_requestor) Or not IsValid (idw_requestor) then
	return -1
end if

// If the datawindow is not in QueryMode, then return error
if Lower (idw_Requestor.Describe ( "DataWindow.QueryMode" )) <> "yes" then
	return -1
else
	if idw_requestor.AcceptText() <> 1 then return -1 

	// Prompt the user with a File Save Dialog.
	li_value = GetFileSaveName (as_title, as_pathname, as_filename, as_ext, as_filter) 

	// If the user choses a file, then write the Query criteria to the file.
	if li_value = 1 then
		li_fileno = FileOpen (as_pathname, StreamMode!, Write!, LockWrite!, Replace!)
		if li_fileno < 0 then return -2
		ls_data = idw_requestor.Describe ("dataWindow.data")
		if FileWrite (li_fileno, ls_data) < 0 then return -2
		if FileClose (li_fileno) < 0 then return -2
	end if
end if

return li_value
end function

     
Name Owner
pfc_n_cst_dwsrv_querymode.of_save pfc_n_cst_dwsrv_querymode
pfc_n_cst_dwsrv_querymode.of_save pfc_n_cst_dwsrv_querymode

     
Name Owner
datawindow.accepttext datawindow
datawindow.describe datawindow
systemfunctions.fileclose systemfunctions
systemfunctions.fileopen systemfunctions
systemfunctions.filewrite systemfunctions
systemfunctions.getfilesavename systemfunctions
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.lower systemfunctions

     
Full name
No Data

     
Name Scope
No Data