of_settonullifempty


pfcdwsrv.pbl   >   pfc_n_cst_dwsrv_reqcolumn   >   of_settonullifempty   

Full name pfc_n_cst_dwsrv_reqcolumn.of_settonullifempty
Access public
Extend of integer
Return value integer
Prototype public function integer of_settonullifempty(long,string,string)

Name Datatype
No Data

Name Datatype
la_currentvalue any
ls_describe string
ls_null string
ls_rc string

public function integer of_settonullifempty (long al_row, string as_colname, string as_text);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_SetToNullIfEmpty
//
//	Access:    Public
//
//	Arguments:
//	al_row		The row to check.
//	as_colname	The column name to check on.
//	as_text		The current text to check.
//
//	Returns:  	Integer
//					 3	Reject the data value but allow focus to change.
//						The empty string was not converted to string since the current
//						value on the dw buffer is a null value.   A return code of 3 on
//						the itemerror will reject the value thus leaving it with
//						a null.
//					 1 Converted Empty value to a Null via a dw_cntrl.SetItem.
//						A return code of 3 on the itemerror will leave the null value
//						on the field.
//					 0 No action was taken.
//					-1 an error occurred.
//
//	Description:  
//
//////////////////////////////////////////////////////////////////////////////
//	
//	Revision History
//
//	Version
//	5.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.
//////////////////////////////////////////////////////////////////////////////

string	ls_describe
string	ls_rc
string	ls_null
any		la_currentvalue
SetNull  (ls_null)

// Determine if the field has an empty value.
If as_text <> '' Then Return 0

// Determine if the column is marked to be skipped.
IF Pos(Lower(is_skip), '~t'+Lower(as_colname)+'~t') > 0 Then Return 0

// Determine if the error is because it is Required Field. 
ls_describe =	as_colname + '.Edit.Required ' + &
					as_colname + '.EditMask.Required ' + &
					as_colname + '.DDLB.Required ' + &
					as_colname + '.DDDW.Required '
ls_rc = idw_requestor.Describe(ls_describe)
If Pos(Lower(ls_rc), 'yes') = 0 Then Return 0

// The field is a Required Field; Now determine if Nulls are allowable. 
ls_describe =	as_colname + '.Edit.NilIsNull ' + &
					as_colname + '.DDLB.NilIsNull ' + &
					as_colname + '.DDDW.NilIsNull ' 	
ls_rc = idw_requestor.Describe(ls_describe)
If Pos(Lower(ls_rc), 'yes') = 0 Then Return 0

//////////////////////////////////////////////////////////////////////////////
// The field is a Required Field Which has the NilIsNul attributes on. 
//////////////////////////////////////////////////////////////////////////////

// Get the current value on this row/column.
la_currentvalue = of_GetItemAny(al_row, as_colname)

// Prevent the Row and Item Status from changing if the value was 
//	originally null.
If IsNull(la_currentvalue) Then 
	Return 3
End If

// Convert the empty string to a Null value.
// The of_SetItem will handle the Column Type value. 
Return of_SetItem (al_row, as_colname, ls_null)

end function

     
Name Owner
pfc_u_dw.itemerror pfc_u_dw

     
Name Owner
datawindow.describe datawindow
systemfunctions.isnull systemfunctions
systemfunctions.lower systemfunctions
systemfunctions.pos systemfunctions
systemfunctions.setnull systemfunctions
pfc_n_cst_dwsrv.of_setitem pfc_n_cst_dwsrv
pfc_n_cst_dwsrv.of_GetItemany pfc_n_cst_dwsrv

     
Full name
No Data

     
Name Scope
No Data