of_filterdetails


pfcdwsrv.pbl   >   pfc_n_cst_dwsrv_linkage   >   of_filterdetails   

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

Name Datatype
No Data

Name Datatype
li_i Integer
li_numlinks Integer
li_rc Integer
ls_expression String
ls_filter String
ls_value string
NOMATCH_FILTER string

protected function integer of_filterdetails (long al_row);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  	of_FilterDetails
//
//	Access:    	Protected
//
//	Arguments:
//   al_row: 	The current row of the master datawindow
//
//	Returns:   	Integer
//   				1 if it succeeds.
//					0 if there is no need to refresh.
//					-1 if an error occurs.
//
//	Description:  Filters detail datawindows based on current row
//					  values in the detail's master.
//
//	   *Note:	This function is not typically called by the developer.  
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
// 5.0.04 Notification of row changed is needed when the filter is the same as previous.
// 6.0 	Changed to use of_BuildExpression.
//
//////////////////////////////////////////////////////////////////////////////
//
//	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_i
Integer	li_numlinks
Integer 	li_rc
String	ls_expression
String	ls_filter=""
string	ls_value
constant string NOMATCH_FILTER = '1 = 2'

// Not a valid operation for a root datawindow.
If of_IsRoot ( ) Then Return FAILURE 

// Check for an invalid row; see processing for empty expression.
If al_row>0 Then 
	// Loop thru all the link columns and construct a filter expression.
	li_numlinks = UpperBound ( inv_linkargs.is_mastercolarg ) 
	For li_i = 1 to li_numlinks

		// Check for an invalid row; see processing after loop.
		If IsNull(al_row) or al_row<=0 Then Continue

		// Get the current value on the master dw (use the master column).
		ls_value = string( idw_master.inv_Linkage.of_GetItemAny &
			(al_row, inv_linkargs.is_mastercolarg[li_i]))

		// Build the Expresion with the Detail Column.
		ls_expression = of_BuildExpression (0, inv_linkargs.is_detailcolarg[li_i], '=', ls_value)

		// Build the Filter statement.
		If IsNull(ls_expression) or Len(Trim(ls_expression))=0 Then Continue
		If ls_filter <> "" Then ls_filter += ' AND '
		ls_filter += ls_expression
	Next 
End If

//	processing for empty expression.
//	If the filter expression is empty, then the master row is is invalid or the column 
//	links are not populated, so construct a filter that will always return FALSE. 
If ls_filter = "" Then 
	//	This will clear the details.
	ls_filter = NOMATCH_FILTER
End If

// Don't re-filter, if it's the same as the last time.
If (is_filterexp <> ls_filter) Or (is_filterexp = NOMATCH_FILTER) Then 
	// Save the new filter expression.
	is_filterexp = ls_filter

	// Perform the filter.
	If idw_Requestor.SetFilter(ls_filter) <> 1 Then 
		Return FAILURE
	End If
	li_rc = idw_Requestor.Filter ( ) 
End If

// Fire the event to indicate that the row has changed.
idw_Requestor.Event pfc_rowchanged ( ) 

Return li_rc
 
end function

     
Name Owner
pfc_n_cst_dwsrv_linkage.of_retrieve pfc_n_cst_dwsrv_linkage
pfc_n_cst_dwsrv_linkage.of_refresh pfc_n_cst_dwsrv_linkage

     
Name Owner
datawindow.filter datawindow
datawindow.setfilter datawindow
systemfunctions.isnull systemfunctions
systemfunctions.len systemfunctions
systemfunctions.string systemfunctions
systemfunctions.trim systemfunctions
systemfunctions.upperbound systemfunctions
pfc_n_cst_dwsrv_linkage.of_isroot pfc_n_cst_dwsrv_linkage
pfc_n_cst_dwsrv.of_GetItemany pfc_n_cst_dwsrv
pfc_n_cst_dwsrv.of_buildexpression pfc_n_cst_dwsrv
pfc_u_dw.pfc_rowchanged pfc_u_dw

     
Full name
No Data

     
Name Scope
No Data