BBjTemplatedString::setString

Description

In BBj 7.0 and higher, this method sets the string value stored in the BBjTemplatedString.

Syntax

Return Value

Method

void

setString(string value)

Parameters

Variable

Description

value

The value which is to be placed into the BBjTemplatedString.

Return Value

None.

Remarks

This method actually accepts a byte array for this parameter. BBj automatically converts any BBjString or String passed in to a byte array.

Example

template$ = "name[5]:c(32*),context:u(2),code:u(1),id:u(2),objtype:i(2)"

dim A$:template$
B!=BBjAPI().makeTemplatedString(template$)

?"template for A$: ", FATTR(A$)
?"template for B!: ", B!.fattr()

A.name$[1]="aaa"
A.name$[5] = "eee"
A.context = 22
A.code = 3
A.id = 44
A.objType = 55

B!.setString(A$)

?B!.getFieldAsString("name",1)," = ", A.name$[1]
?B!.getFieldAsString("name",5)," = ", A.name$[5]
?B!.getFieldAsNumber("context")," = ", A.context
?B!.getFieldAsNumber("code"),   " = ", A.code
?B!.getFieldAsNumber("id"),     " = ", A.id
?B!.getFieldAsNumber("objType")," = ", A.objType

B!.setFieldValue("name",1,"XXX")
B!.setFieldValue("name",5,"ZZZ")
B!.setFieldValue("context",66)
B!.setFieldValue("code",7)
B!.setFieldValue("id",88)
B!.setFieldValue("objType",9)

A$=B!.getString()

?
?B!.getFieldAsString("name",1)," = ", A.name$[1]
?B!.getFieldAsString("name",5)," = ", A.name$[5]
?B!.getFieldAsNumber("context")," = ", A.context
?B!.getFieldAsNumber("code"),   " = ", A.code
?B!.getFieldAsNumber("id"),     " = ", A.id
?B!.getFieldAsNumber("objType")," = ", A.objType

See Also

String Templates

BBjAPI

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