BBjRecordData::setFieldValue

Description

In BBj 4.0 and higher, this method changes the value of a field in the specified BBjRecordData object.

Syntax

Return Value

Method

void

setFieldValue(string fieldname, string value)

Parameters

Variable

Description

fieldname

Specifies the name of the field.

value

Specifies the value assigned to this field.

Return Value

None.

Remarks

Field values are always set as strings.

Example

rem ' getFieldValue.bbj

rem ' Define the connection information
database$ = "ChileCompany"
table$ = "CUSTOMER"
user$="admin"
password$="admin123"
connect$="jdbc:basis:localhost?database="+database$+"&user="+user$+"&password="+password$
modes$=""
select$ = "select * from "+table$

rem ' Create the RecordSet
RecordSet! = BBJAPI().createSQLRecordSet(connect$,modes$,select$)

rem ' Go to the first record
RecordSet!.first()

rem ' Retrieve the RecordData for the current record
RecordData! = RecordSet!.getCurrentRecordData()

rem ' Change the last name
print "Last name was: ",RecordData!.getFieldValue("last_name")
RecordData!.setFieldValue("last_name","Jones")
print "Last name now: ",RecordData!.getFieldValue("last_name")
stop

See Also

BBjAPI

BBjRecordData

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.