|
of_buildfilterattrib
|
|
Full name
|
pfc_n_cst_dwsrv_filter.of_buildfilterattrib
|
Access
|
protected
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
protected function integer of_buildfilterattrib(ref n_cst_filterattrib)
|
Name
|
Datatype
|
lb_exclude
|
boolean
|
li_exclude
|
integer
|
li_i
|
integer
|
li_j
|
integer
|
li_k
|
integer
|
li_numcols
|
integer
|
li_numcomputes
|
integer
|
ls_computes
|
string[]
|
ls_dbname
|
string
|
ls_filter
|
string
|
ls_filtercolumns_all
|
string[]
|
ls_filtercolumns_exc
|
string[]
|
protected function integer of_buildfilterattrib (ref n_cst_filterattrib anv_filterattrib);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_BuildFilterAttrib
//
// Access: protected
//
// Arguments:
// astr_filterattrib: A NVO attribute class, passed by reference, that
// will hold filter information used by the Filter dialogs.
//
// Returns: Integer
// 1 if it succeeds and -1 if an error occurs.
//
// Description: Prepares the filter information required by the
// Specify Filter dialogs.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version.
// 5.0.02 Prevent excluded columns from appearing as blank entries.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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_numcols
integer li_numcomputes
integer li_i
integer li_j
integer li_k
integer li_exclude
string ls_computes[] // Hold all the computed columns.
string ls_filtercolumns_all[] // Hold all filter columns prior to any exclusions.
string ls_filtercolumns_exc[] // Hold filter columns after excluding appropriate ones.
string ls_dbname
string ls_filter
boolean lb_exclude
// Check the dw refernce.
If IsNull(idw_requestor) Or Not IsValid(idw_requestor) Then Return -1
// Get the original filter for the datawindow.
ls_filter = of_GetFilter()
If Len(ls_filter) > 0 And ls_filter = is_filterout then
ls_filter = is_filterin
end If
anv_filterattrib.is_filter = ls_filter
// Get all the column names on the datawindow.
li_numcols = of_GetObjects(ls_filtercolumns_all, "column", "*", ib_visibleonly)
// Get all the computed column names on the datawindow and add them to the array.
li_numcomputes = of_GetObjects(ls_computes, "compute", "*", ib_visibleonly)
// Add compute columns to the array.
FOR li_i = 1 to li_numcomputes
li_numcols++
ls_filtercolumns_all[li_numcols] = ls_computes[li_i]
NEXT
// See if any columns were set to be excluded from the filter display
// and create a new list of sort columns.
li_exclude = UpperBound(is_excludecolumns)
FOR li_j = 1 to li_numcols
lb_exclude = FALSE
FOR li_i = 1 to li_exclude
IF Lower(is_excludecolumns [li_i]) = Lower(ls_filtercolumns_all[li_j]) THEN
lb_exclude = TRUE
EXIT
END IF
NEXT
IF Not lb_exclude THEN
li_k++
ls_filtercolumns_exc[li_k] = ls_filtercolumns_all[li_j]
END IF
NEXT
// Copy the list of appropriate sort columns to the nvo.
anv_filterattrib.is_columns = ls_filtercolumns_exc
li_numcols = UpperBound(anv_filterattrib.is_columns)
// Add the database names to the attributes.
FOR li_i = 1 to li_numcols
ls_dbname = idw_Requestor.Describe ( anv_filterattrib.is_columns[li_i] + ".DbName" )
IF ls_dbname = "" OR ls_dbname = "!" THEN ls_dbname = anv_filterattrib.is_columns[li_i]
anv_filterattrib.is_dbnames[li_i] = ls_dbname
NEXT
// Get the column displayname.
CHOOSE CASE of_GetColumNnameSource ( )
CASE 0
// Use dw Column Names.
FOR li_i = 1 to li_numcols
anv_filterattrib.is_colnamedisplay[li_i] = anv_filterattrib.is_columns[li_i]
NEXT
CASE 1
// Use Database Names.
FOR li_i = 1 to li_numcols
ls_dbname = idw_Requestor.Describe ( anv_filterattrib.is_columns[li_i] + ".DbName" )
IF ls_dbname = "" OR ls_dbname = "!" THEN ls_dbname = anv_filterattrib.is_columns[li_i]
anv_filterattrib.is_colnamedisplay[li_i] = ls_dbname
NEXT
CASE 2
// Use Column Headers.
FOR li_i = 1 to li_numcols
anv_filterattrib.is_colnamedisplay[li_i] = &
of_GetHeaderName ( anv_filterattrib.is_columns[li_i] )
NEXT
END CHOOSE
Return 1
end function