base.TypeInfo.create()

Create a DomNode with the type information and values of a program variable.

Syntax

base.TypeInfo.create(
      field { primitive-type
            | record-type
            | array-type
            | dictionary-type
            }
    )
  RETURNS om.DomNode
  1. field is the program variable to convert to DOM.
  2. primitive-type is a primitive data type of Genero (INTEGER, DATE, VARCHAR)
  3. record-type is a RECORD ... END RECORD type.
  4. array-type is a DYNAMIC ARRAY OF ... or ARRAY[n] OF ... type.
  5. dictionary-type is a DICTIONARY OF ... type.

Usage

Use the base.TypeInfo.create() class method to create an 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 produces 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>