|
of_setitem
|
|
Full name
|
pfc_n_cst_dwsrv.of_setitem
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_setitem(long,string,string)
|
Name
|
Datatype
|
ld_val
|
date
|
ldb_val
|
double
|
ldc_val
|
decimal
|
li_rc
|
integer
|
ll_val
|
long
|
lnv_conversion
|
n_cst_conversion
|
lnv_string
|
n_cst_string
|
lr_val
|
real
|
ls_string_value
|
string
|
ltm_val
|
time
|
public function integer of_setitem (long al_row, string as_column, string as_value);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_SetItem (FORMAT 2)
//
// Access: Public
//
// Arguments:
// al_row : The row reference for the value to be set
// as_column : The column name reference
// as_value : The value of the column in string format
//
// Returns: Integer
// 1 = if it succeeds
// -1 = if an error occurs
//
// Description: Sets the specified row/column to the passed value.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 5.0.02 Fixed problem with datetime columns being set to invalid datetime values
// Added error checking for arguments.
// 6.0.01 Fixed where number and real datatype was being converted into a long.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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_rc
date ld_val
decimal ldc_val
double ldb_val
long ll_val
real lr_val
string ls_string_value
time ltm_val
n_cst_string lnv_string
n_cst_conversion lnv_conversion
// Check arguments
if IsNull (al_row) or IsNull (as_column) then
return -1
end if
if IsNull (idw_requestor) or not IsValid (idw_requestor) then
return -1
end if
/* Determine the datatype of the column and then call the SetItem
with proper datatype */
CHOOSE CASE Lower ( Left ( idw_Requestor.Describe ( as_column + ".ColType" ) , 5 ) )
CASE "char(", "char" // CHARACTER DATATYPE
li_rc = idw_Requestor.SetItem ( al_row, as_column, as_value )
CASE "date" // DATE DATATYPE
li_rc = idw_Requestor.SetItem ( al_row, as_column, Date (as_value) )
CASE "datet" // DATETIME DATATYPE
ld_val = lnv_conversion.of_Date (as_value)
ltm_val = lnv_conversion.of_Time (as_value)
li_rc = idw_Requestor.SetItem (al_row, as_column, DateTime (ld_val, ltm_val))
CASE "decim" // DECIMAL DATATYPE
/* Replace formatting characters in passed string */
ls_string_value = lnv_string.of_GlobalReplace (as_value, "$", "" )
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, ",", "" )
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, "(", "-")
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, ")", "")
if Pos (ls_string_value, "%") > 0 then
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, "%", "")
ldc_val = Dec (ls_string_value) / 100
else
ldc_val = Dec (ls_string_value)
end if
li_rc = idw_Requestor.SetItem ( al_row, as_column, ldc_val)
CASE "numbe", "doubl" // NUMBER DATATYPE
/* Replace formatting characters in passed string */
ls_string_value = lnv_string.of_GlobalReplace (as_value, "$", "" )
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, ",", "" )
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, "(", "-")
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, ")", "")
if Pos (ls_string_value, "%") > 0 then
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, "%", "")
ldb_val = Double (ls_string_value) / 100
else
ldb_val = Double (ls_string_value)
end if
li_rc = idw_Requestor.SetItem ( al_row, as_column, ldb_val)
CASE "real" // REAL DATATYPE
/* Replace formatting characters in passed string */
ls_string_value = lnv_string.of_GlobalReplace (as_value, "$", "" )
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, ",", "" )
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, "(", "-")
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, ")", "")
if Pos (ls_string_value, "%") > 0 then
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, "%", "")
lr_val = Real (ls_string_value) / 100
else
lr_val = Real (ls_string_value)
end if
li_rc = idw_Requestor.SetItem ( al_row, as_column, lr_val)
CASE "long", "ulong" // LONG/INTEGER DATATYPE
/* Replace formatting characters in passed string */
ls_string_value = lnv_string.of_GlobalReplace (as_value, "$", "" )
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, ",", "" )
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, "(", "-")
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, ")", "")
if Pos (ls_string_value, "%") > 0 then
ls_string_value = lnv_string.of_GlobalReplace (ls_string_value, "%", "")
ll_val = Long (ls_string_value) / 100
else
ll_val = Long (ls_string_value)
end if
li_rc = idw_Requestor.SetItem ( al_row, as_column, ll_val)
CASE "time", "times" // TIME DATATYPE
li_rc = idw_Requestor.SetItem ( al_row, as_column, Time ( as_value ) )
END CHOOSE
Return li_rc
end function
Name
|
Owner
|
datawindow.describe |
datawindow
|
datawindow.setitem |
datawindow
|
datawindow.setitem |
datawindow
|
systemfunctions.date |
systemfunctions
|
systemfunctions.datetime |
systemfunctions
|
systemfunctions.dec |
systemfunctions
|
systemfunctions.double |
systemfunctions
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.isvalid |
systemfunctions
|
systemfunctions.left |
systemfunctions
|
systemfunctions.long |
systemfunctions
|
systemfunctions.lower |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
systemfunctions.real |
systemfunctions
|
systemfunctions.time |
systemfunctions
|
pfc_n_cst_string.of_globalreplace |
pfc_n_cst_string
|
pfc_n_cst_conversion.of_date |
pfc_n_cst_conversion
|
pfc_n_cst_conversion.of_time |
pfc_n_cst_conversion
|