|
of_CheckRequired
|
|
Full name
|
pfc_u_dw.of_CheckRequired
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_CheckRequired(dwbuffer,ref long,ref integer,ref string,boolean)
|
Name
|
Datatype
|
lb_skipmessage
|
boolean
|
li_rc
|
integer
|
ls_msgparm
|
string[2]
|
lw_parent
|
window
|
lw_pfcparent
|
w_master
|
public function integer of_CheckRequired (dwbuffer adw_buffer, ref long al_row, ref integer ai_col, ref string as_colname, boolean ab_updateonly);//////////////////////////////////////////////////////////////////////////////
// Public Function: of_CheckRequired
// Arguments: adw_buffer The buffer to check for required fields
// al_row First row to be checked. Also stores the number of the found row
// ai_col First column to be checked. Also stores the number of the found column
// as_colname Contains the columnname in error
// Returns: Integer
// 1 = The required fields test was successful, check arguments for required fields missing
// 0 = The required fields test was successful and no errors were found
// -1 = Error
// Description: Calls the FindRequired function to determine if any of the required columns contain null values.
//////////////////////////////////////////////////////////////////////////////
// Rev. History Version
// 5.0 Initial version
// 6.0.01 Enhanced to call stub function which allows for more flexibility and control.
//////////////////////////////////////////////////////////////////////////////
// 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.
//////////////////////////////////////////////////////////////////////////////
w_master lw_pfcparent
window lw_parent
boolean lb_skipmessage=false
string ls_msgparm[2]
integer li_rc
// Check arguments
if IsNull (adw_buffer) or IsNull (al_row) or IsNull (ai_col) or IsNull (as_colname) then return FAILURE
SetPointer(HourGlass!)
// Call FindRequired to locate first error, if any
if this.FindRequired (adw_buffer, al_row, ai_col, as_colname, ab_updateonly) < 0 then return FAILURE
// Double Check if failure condition was ecountered.
if al_row < 0 then return FAILURE
// Check if no missing values were found.
if al_row = 0 then return 0
// -- A Missing Value was encountered. --
// Get a reference to the window
this.of_GetParentWindow (lw_parent)
if IsValid (lw_parent) then
if lw_parent.TriggerEvent ("pfc_descendant") = 1 then
lw_pfcparent = lw_parent
end if
end if
// Make sure the window is not closing.
if IsValid (lw_pfcparent) then
if lw_pfcparent.of_GetCloseStatus() then
// It is closing, so don't show errors now.
lb_skipmessage = true
end if
end if
// Skip the message if the window is closing.
if not lb_skipmessage then
// Call stub function to either handle condition or provide a more suitable
// column name.
li_rc = this.Event pfc_checkrequirederror (al_row, as_colname)
if li_rc < 0 then return -1
if li_rc >= 1 then
// Display condition.
if IsValid(gnv_app.inv_error) then
ls_msgparm[1] = as_colname
ls_msgparm[2] = String (al_row)
gnv_app.inv_error.of_Message("pfc_requiredmissing", ls_msgparm, &
gnv_app.iapp_object.DisplayName)
else
of_MessageBox ("pfc_checkrequired_missingvalue", gnv_app.iapp_object.DisplayName, &
"Required value missing for " + as_colname + " on row " + String (al_row) + &
". Please enter a value.", information!, Ok!, 1)
end if
// Make sure row/column gets focus.
this.SetRow (al_row)
this.ScrollToRow (al_row)
this.SetColumn (ai_col)
this.SetFocus ()
end if
end if
// Return that a required column does contain a null value.
return 1
end function