of_undomodified


pfcdwsrv.pbl   >   pfc_n_cst_dwsrv_linkage   >   of_undomodified   

Full name pfc_n_cst_dwsrv_linkage.of_undomodified
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_undomodified()

Name Datatype
No Data

Name Datatype
le_colstatus dwItemStatus
le_rowstatus dwItemStatus
li_fnrc integer
li_idx integer
li_modcnt integer
ll_colcnt long
ll_currrow long
ll_row long
ls_null string

protected function integer of_undomodified ();//////////////////////////////////////////////////////////////////////////////
//
//	Function:  		of_UndoModified
//
//	Access:    		Protected
//
//	Arguments: 		None
//
//	Returns:   		Integer
// # of rows that were modified.
//	-1 error 
//
//	Description:  
//	Performs the necessary actions to loose all changes in the current
//	datawindow.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	6.0   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 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_modcnt
integer	li_fnrc
integer	li_idx
long		ll_row = 0
long		ll_colcnt = 0
long		ll_currrow
string	ls_null
dwItemStatus le_rowstatus
dwItemStatus le_colstatus

SetNull(ls_null)

// Check required references.
If IsNull(idw_requestor) or Not IsValid(idw_requestor) Then
	Return -1
End If

// Get and validate the number of columns in the datawindow.
ll_colcnt = Integer( idw_requestor.Describe('DataWindow.Column.Count'))
If ll_colcnt = 0 Then Return 0

// Loop around all the modified rows.
Do 
	// Get the next row that has been modified.
	ll_row = idw_requestor.GetNextModified ( ll_row, Primary!)
	If ll_row <= 0 Then Exit

	// Get the row information.
	ll_currrow = idw_requestor.GetRow()
	le_rowstatus = idw_requestor.GetItemStatus(ll_row, 0, Primary!)

	If le_rowstatus = DataModified! Then
		// -- Reset the data to the original values. --
		For li_idx = 1 to ll_colcnt
			If idw_requestor.Object.Data.Primary[ll_row, li_idx] <> &
				idw_requestor.Object.Data.Original[ll_row, li_idx] Then
				idw_requestor.Object.Data.Primary[ll_row, li_idx] = &
					idw_requestor.Object.Data.Original[ll_row, li_idx]
			End If
		Next
		// This will convert DataModified row to NotModified.
		idw_requestor.SetItemStatus(ll_row, 0, Primary!, NotModified!)	
	Else // NewModified!
		// Reset the row to a New! row.
		For li_idx = 1 to ll_colcnt
			le_colstatus = idw_requestor.GetItemStatus(ll_row, li_idx, Primary!)
			If le_colstatus = NewModified! or le_colstatus = DataModified! Then
				li_fnrc = of_SetItem(ll_row, li_idx, ls_null)
				If li_fnrc <> 1 Then Return FAILURE
			End If
		Next
		// This will convert NewModified! row to New!.
		idw_requestor.SetItemStatus(ll_row, 0, Primary!, NotModified!)	
		// Make sure the row has the right key values.
		of_SetKeyValues (ll_row)
	End If
	
	li_modcnt ++
	
Loop Until ll_row <= 0

Return li_modcnt
end function

     
Name Owner
pfc_n_cst_dwsrv_linkage.pfc_rowfocuschanging pfc_n_cst_dwsrv_linkage
pfc_n_cst_dwsrv_linkage.pfc_preinsertrow pfc_n_cst_dwsrv_linkage
pfc_n_cst_dwsrv_linkage.pfc_clicked pfc_n_cst_dwsrv_linkage

     
Name Owner
datawindow.describe datawindow
datawindow.getitemstatus datawindow
datawindow.getnextmodified datawindow
datawindow.getrow datawindow
datawindow.setitemstatus datawindow
systemfunctions.integer systemfunctions
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.setnull systemfunctions
pfc_n_cst_dwsrv_linkage.of_setkeyvalues pfc_n_cst_dwsrv_linkage
pfc_n_cst_dwsrv.of_setitem pfc_n_cst_dwsrv

     
Full name
No Data

     
Name Scope
No Data