|
of_buildcomparison
|
|
Full name
|
pfc_n_cst_dssrv.of_buildcomparison
|
Access
|
public
|
Extend of
|
any
|
Return value
|
any
|
Prototype
|
public function any of_buildcomparison(long,string,string)
|
Name
|
Datatype
|
ls_coltype
|
string
|
ls_expression
|
string
|
ls_value
|
string
|
public function any of_buildcomparison (long al_row, string as_column, string as_optionalvalue);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_BuildComparison
//
// Access: Public
//
// Arguments:
// al_row : The row reference
// as_column : The column name reference
// as_optionalvalue: An optional value. If found it will not used the
// row/column value.
//
// Returns: string
// The comparison string.
//
// Description:
// Returns a comparison string that can be used on any Find or Filter operation.
// As opposed to the of_BuildExpression() the resulting string does not contain
// the as_column information, this way the expression can easily be associated with
// any another column.
// For example, 'Date("1/1/95")' will be the result for
// as_column='hired_date', as_optionalvalue='1/1/95'.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
// 7.0 Added "char" datatype to case statement
//
//////////////////////////////////////////////////////////////////////////////
//
// 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_expression
string ls_coltype
string ls_value
// Validate required reference.
If IsNull(ids_requestor) Or Not IsValid(ids_requestor) Then Return '!'
// Verify passed arguments.
If as_optionalvalue = '#@notapplicable@#' Then
// Only test row number when there is no optional value.
If IsNull(al_row) or al_row <= 0 or al_row > ids_requestor.RowCount() Then Return '!'
End If
If Len(Trim(as_column))=0 or IsNull(as_column) Then Return '!'
// Get the column type.
ls_coltype = ids_requestor.Describe(as_column+'.ColType')
If ls_coltype='!' or ls_coltype="?" Then Return '!'
// Either get the current value or use the passed in value.
If as_optionalvalue = '#@notapplicable@#' Then
ls_value = string( of_GetItemAny(al_row, as_column) )
Else
ls_value = as_optionalvalue
End If
If IsNull(ls_value) Then
// Handle NULL values.
ls_expression = 'IsNull('+as_column+')'
Else
// Wrap the value with datatype conversion functions, so that
// the value is valid in Filter and Find expressions.
// Note: a number value does not need any special handling.
Choose Case Lower ( Left (ls_coltype, 5 ) )
// CHARACTER DATATYPE
Case "char(", "char"
ls_expression += "'" + ls_value + "'"
// DATE DATATYPE
Case "date"
ls_expression += "Date('" + ls_value + "')"
// DATETIME DATATYPE
Case "datet"
ls_expression += "DateTime('" + ls_value + "')"
// TIME DATATYPE
Case "time", "times"
ls_expression += "Time('" + ls_value + "')"
// Number
Case Else
ls_expression += ls_value
End Choose
End If
Return ls_expression
end function
Name
|
Owner
|
datastore.describe |
datastore
|
datastore.rowcount |
datastore
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.isvalid |
systemfunctions
|
systemfunctions.left |
systemfunctions
|
systemfunctions.len |
systemfunctions
|
systemfunctions.lower |
systemfunctions
|
systemfunctions.string |
systemfunctions
|
systemfunctions.trim |
systemfunctions
|
pfc_n_cst_dssrv.of_GetItemany |
pfc_n_cst_dssrv
|