|
pfc_replace
|
|
Full name
|
pfc_n_cst_dwsrv_find.pfc_replace
|
Access
|
public
|
Extend of
|
long
|
Return value
|
long
|
Prototype
|
event long pfc_replace(n_cst_findattrib)
|
Name
|
Datatype
|
li_rc
|
integer
|
ll_currrow
|
long
|
ll_row
|
long
|
ls_coleditstatus
|
string
|
ls_colname
|
string
|
event pfc_replace;call n_cst_dwsrv::pfc_replace;//////////////////////////////////////////////////////////////////////////////
//
// Event: pfc_replace
//
// Arguments:
// anv_findattrib search attributes.
//
// Returns: integer
// The find results..
// 0 = No row was found.
// -1 = Error;
// No FindNext was performed.
// -2 = The replace operation was not valid because the
// ReplaceWith value was not of the correct type;
// or the field is protected;
// No FindNext was performed.
//
// Description: Search and replace using the passed in settings.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
long ll_row
long ll_currrow
string ls_colname
integer li_rc
string ls_coleditstatus
If ib_ongoingfind Then
//Determine if this continues to be an Ongoing Find.
ib_ongoingfind = of_IsOnGoingFind(anv_findattrib)
End If
//Make a copy of passed argument.
inv_findattrib = anv_findattrib
//Get the current row.
ll_currrow = idw_requestor.GetRow()
//Get the current column.
ls_colname = inv_findattrib.is_lookdata[inv_findattrib.ii_lookindex]
//Get the column edit status.
ls_coleditstatus = of_GetColumnEditStatus(ls_colname, ll_currrow)
//Determine if the current row/column can be replaced.
If ls_coleditstatus = 'editable' Then
//Build find expression.
is_findexpression = of_BuildFindExpression(inv_findattrib.is_find, ls_colname)
If is_findexpression = '!' Then Return 0
If idw_requestor.GetColumnName() = ls_colname Then
//Attempt to replace the selected text.
li_rc = of_replace(ll_currrow, ls_colname, inv_findattrib.is_replacewith)
If li_rc = 1 Then
/* Replace was successful. */
ib_replaced = True
ElseIf li_rc = 0 Then
/* Replacing of text was not appropriate. Not an error*/
ElseIf li_rc <= -1 Then
/* An unappropriate action was selected */
Return li_rc
End If
End If
End If
//Perform the find operation.
ll_row = of_Find()
return ll_row
end event