BBjRecordData::getFieldValue

Description

In BBj 4.0 and higher, this method returns the value of a given field in a record data object.

Syntax

Return Value

Method

byte[]

getFieldValue(string fieldname)

Parameters

Variable

Description

fieldname

Specifies the name of the field.

Return Value

Returns the value of a given field in a record data object.

Remarks

Field values are always returned as byte[].

Methods that return byte[] can usually be treated as if they returned string, because BBj automatically handles the conversion. However, when that byte[] value is directly assigned to an object variable or passed to a Java method, BBj skips the conversion and the raw internal byte[] format is used. You can always use the STR() function to explicitly convert the byte[] value to a string.

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 ' Print the RecordData
print "Customer number: ",'LF',RecordData!.getFieldValue("cust_num")
stop

See Also

BBjAPI

BBjRecordData

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