BBjAPI::makeTemplatedString

Description

In BBj 7.00 and higher, this method returns a BBjTemplatedString with a specified template.

Syntax

Return Value

Method

BBjTemplatedString

makeTemplatedString(string template)

Parameters

Variable

Description

template

The template that will define the fields for the returned BBjTemplatedString.

Return Value

Returns a BBjTemplatedString based on the specified template.

Remarks

None.

Example

rem ' BBjTemplatedString

template$ = "name[5]:c(32*),context:u(2),code:u(1),id:u(2),objtype:i(2)"
dim A$:template$
B! = bbjapi().makeTemplatedString(template$)
print "template for A$: ", fattr(A$)
print "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$)
print B!.getFieldAsString("name",1)," = ", A.name$[1]
print B!.getFieldAsString("name",5)," = ", A.name$[5]
print B!.getFieldAsNumber("context")," = ", A.context
print B!.getFieldAsNumber("code"),   " = ", A.code
print B!.getFieldAsNumber("id"),     " = ", A.id
print 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()
print B!.getFieldAsString("name",1)," = ", A.name$[1]
print B!.getFieldAsString("name",5)," = ", A.name$[5]
print B!.getFieldAsNumber("context")," = ", A.context
print B!.getFieldAsNumber("code"),   " = ", A.code
print B!.getFieldAsNumber("id"),     " = ", A.id
print B!.getFieldAsNumber("objType")," = ", A.objType

See Also

String Templates

BBjAPI

Object Variables

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