|
of_buildfindexpression
|
|
Full name
|
pfc_n_cst_dwsrv_find.of_buildfindexpression
|
Access
|
protected
|
Extend of
|
string
|
Return value
|
string
|
Prototype
|
protected function string of_buildfindexpression(string,string)
|
Name
|
Datatype
|
lnv_string
|
n_cst_string
|
ls_coltype
|
string
|
ls_editstyle
|
string
|
ls_findexp
|
string
|
protected function string of_buildfindexpression (string as_find, string as_column);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_BuildFindExpression
//
// Access: protected
//
// Arguments:
// as_find String being searched for.
// as_column The column to search in.
//
// Returns: string
// String expression to use in search.
// '!' if an error is encountered.
//
// Description: This function build the string that is passed to the
// find function.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 5.0.03 Handle searching of quotes.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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_findexp
string ls_coltype
string ls_editstyle
n_cst_string lnv_string
//Check arguments.
If IsNull(as_find) or Len(as_find)=0 or &
IsNull(as_column) or Len(Trim(as_column))=0 Then
Return '!'
End If
//Check required.
If IsNull(idw_requestor) Or Not IsValid(idw_requestor) Then
Return '!'
end If
//Get the column type and edit style.
ls_coltype = idw_requestor.describe(as_column+".coltype")
ls_editstyle = idw_requestor.Describe(as_column+".Edit.Style")
//Create the string according to the column type and edit style.
If ls_editstyle='dddw' or ls_editstyle='ddlb' Then
// Handle searching of quotes by replacing them with the special characters.
If Pos(as_find, "'") > 0 Then
as_find = lnv_string.of_GlobalReplace (as_find, "'", "~~'")
End If
//Add the MatchCase attributes.
if inv_findattrib.ib_matchcase THEN
ls_findexp = "Pos(LookUpDisplay(" +as_column+ "),'" + as_find + "') > 0"
else
ls_findexp = "Pos(Lower(LookUpDisplay(" +as_column+ ")),'" +Lower(as_find)+ "') > 0"
end if
Else
//Process according to the column type.
Choose Case Left(Lower(ls_coltype),4)
Case 'numb', 'long', 'inte', 'deci'
If IsNumber(as_find) Then
ls_findexp = as_column+ " = " + as_find
Else
ls_findexp = "!"
End If
Case 'date'
If IsDate(as_find) Then
ls_findexp = as_column+ " = Date ('" + as_find + "')"
Else
ls_findexp = "!"
End If
Case 'time'
If IsTime(as_find) Then
ls_findexp = as_column+ " = Time ('" + as_find + "')"
Else
ls_findexp = "!"
End If
Case Else
// Handle searching of quotes by replacing them with the special characters.
If Pos(as_find, "'") > 0 Then
as_find = lnv_string.of_GlobalReplace (as_find, "'", "~~'")
End If
//Add the MatchCase attributes.
if inv_findattrib.ib_matchcase THEN
ls_findexp = "Pos(" +as_column+ ",'" + as_find + "') > 0"
else
ls_findexp = "Pos(Lower(" +as_column+ "),'" +Lower(as_find)+ "') > 0"
end if
End Choose
End If
Return ls_findexp
end function
Name
|
Owner
|
datawindow.describe |
datawindow
|
systemfunctions.isdate |
systemfunctions
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.isnumber |
systemfunctions
|
systemfunctions.istime |
systemfunctions
|
systemfunctions.isvalid |
systemfunctions
|
systemfunctions.left |
systemfunctions
|
systemfunctions.len |
systemfunctions
|
systemfunctions.lower |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
systemfunctions.trim |
systemfunctions
|
pfc_n_cst_string.of_globalreplace |
pfc_n_cst_string
|