|
of_getvalues
|
|
Full name
|
pfc_w_filtersimple.of_getvalues
|
Access
|
public
|
Override of
|
|
Return value
|
|
Prototype
|
public subroutine of_getvalues(string)
|
Name
|
Datatype
|
as_column
|
string
|
Name
|
Datatype
|
li_i
|
integer
|
li_newrow
|
integer
|
li_num_values
|
integer
|
li_pos1
|
integer
|
li_pos2
|
integer
|
li_rc
|
integer
|
lnv_string
|
n_cst_string
|
ls_dbname
|
string
|
ls_full_dbname
|
string
|
ls_full_table
|
string
|
ls_owner
|
string
|
ls_select
|
string
|
ls_table
|
string
|
ls_values
|
string[]
|
public subroutine of_getvalues (string as_column);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_GetValues
//
// Access: Public
//
// Arguments:
// as_column: The column to get values for
//
// Returns: None
//
// Description: Obtains a list of distinct values for the specified
// column from the database.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 5.0.02 Validate the required transaction object.
// 5.0.03 Clear the columnvalues via a Reset operation.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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_dbname, ls_select, ls_owner, ls_table
string ls_full_table, ls_full_dbname, ls_values[]
integer li_i, li_pos1, li_pos2, li_num_values , li_newrow, li_rc
n_cst_string lnv_string
// Validate the transaction object.
If IsNull(inv_filterattrib.idw_dw.itr_object) or &
Not IsValid(inv_filterattrib.idw_dw.itr_object) Then
// There is no valid PFC transaction object on the original datawindow.
Return
End If
If not inv_filterattrib.idw_dw.itr_object.of_IsConnected() Then
// There is no connected PFC transaction object on the original datawindow.
Return
End if
If is_prevchildcolumn = as_column Then
// There is no need to get the values.
Return
End If
// Store the last column for which the values were gotten.
is_prevchildcolumn = as_column
SetPointer ( HourGlass! )
// Clear all of the values.
li_rc = idwc_values.Reset()
// Get the database name associated with the column.
ls_dbname = inv_filterattrib.idw_dw.Describe ( as_column + ".DBName" )
// Get the SQL Select for the requesting datawindow.
ls_select = inv_filterattrib.idw_dw.Describe ( "DataWindow.Table.Select" )
If ls_select = "" or ls_select = "!" or ls_select = "?" Then Return
// Search the SQL Select for the owner name associated with the selected column.
li_pos1 = Pos ( ls_select, ls_dbname, 1 )
IF li_pos1 > 0 THEN
li_pos2 = lnv_string.of_lastpos ( ls_select, " ", li_pos1 )
IF li_pos2 > 0 THEN
ls_owner = Trim (Mid ( ls_select, li_pos2, li_pos1 - li_pos2 ))
END IF
END IF
// Create a table and columnname with owner information if available.
ls_table = lnv_string.of_gettoken ( ls_dbname, "." )
IF ls_owner <> "" THEN
ls_full_table = ls_owner + "." + ls_table
ELSE
ls_full_table = ls_table
END IF
ls_full_dbname = ls_full_table + "." + ls_dbname
// Get the distinct values.
inv_filterattrib.idw_dw.itr_object.of_distinctvalues ( ls_full_table, ls_full_dbname, &
ls_values )
// Populate the DropDownDatawidow column with the column values.
li_num_values = UpperBound ( ls_values )
FOR li_i = 1 to li_num_values
// Insert new row.
li_newrow = idwc_values.InsertRow ( 0 )
// Populate the values for the new row.
idwc_values.SetItem ( li_newrow, "value", ls_values[li_i] )
NEXT
// Sort the DropDownDatawidow
idwc_values.Sort()
end subroutine
Name
|
Owner
|
datawindow.describe |
datawindow
|
datawindowchild.insertrow |
datawindowchild
|
datawindowchild.reset |
datawindowchild
|
datawindowchild.setitem |
datawindowchild
|
datawindowchild.sort |
datawindowchild
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.isvalid |
systemfunctions
|
systemfunctions.mid |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
systemfunctions.setpointer |
systemfunctions
|
systemfunctions.trim |
systemfunctions
|
systemfunctions.upperbound |
systemfunctions
|
pfc_n_cst_string.of_gettoken |
pfc_n_cst_string
|
pfc_n_cst_string.of_lastpos |
pfc_n_cst_string
|
pfc_n_tr.of_IsConnected |
pfc_n_tr
|
pfc_n_tr.of_DistinctValues |
pfc_n_tr
|