base.TypeInfo.create()
Create a DomNode with the type information and values of a program variable.
Syntax
base.TypeInfo.create(
field { base-type
| record-type
| dynamic-array-type
| static-array-type
| dictionary-type
}
)
RETURNS om.DomNode
- field is the program variable to convert to DOM.
- base-type is a base data type of Genero (
INTEGER
,DATE
,VARCHAR
) - record-type is a
RECORD ... END RECORD
type. - dynamic-array-type is a
DYNAMIC ARRAY OF ...
type. - static-array-type is an
ARRAY[n] OF ...
type. - dictionary-type is a
DICTIONARY OF ...
type.
Usage
Use the base.TypeInfo.create()
class method to create a
om.DomNode
object from a program variable.
The DOM node contains type information and values of the program variable.
The program variable provided to the method is typically a RECORD
,
but it can be any sort of structured variable, including arrays.
The data is formatted based on current environment settings (DBDATE, DBFORMAT, and DBMONEY).
The method trims trailing blanks for STRING, CHAR and VARCHAR data, and therefore produce empty strings in the resulting dom elements, when the source variable contains only blanks.
Example
MAIN
DEFINE n om.DomNode
DEFINE r RECORD
key INTEGER,
lastname CHAR(20),
birthdate DATE,
comment VARCHAR(200)
END RECORD
LET r.key = 234
LET r.lastname = "Johnson"
LET r.birthdate = MDY(12,24,1962)
LET r.comment = " "
LET n = base.TypeInfo.create( r )
DISPLAY n.toString()
END MAIN
The generated node contains variable values and data type information:
<?xml version="1.0"? encoding="ISO-8859-1">
<Record>
<Field type="INTEGER" value="234" name="key"/>
<Field type="CHAR(20)" value="Johnson" name="lastname"/>
<Field type="DATE" value="12/24/1962" name="birthdate"/>
<Field type="VARCHAR(200)" value="" name="comment"/>
</Record>