BuildFromDataStore

Description

Builds a PBDOM_DOCUMENT from the referenced DataStore object.

Syntax

pbdom_builder_name.BuildFromDataStore(datastore datastore_ref)

Argument

Description

pbdom_builder_name

The name of a PBDOM_BUILDER object

datastore_ref

A DataStore object


Return value

PBDOM_DOCUMENT.

Throws

EXCEPTION_INVALID_ARGUMENT -- The input DataStore object is invalid. This can happen if it has not been initialized properly or is a null object reference.

Examples

The following PowerScript code fragment demonstrates how to use the BuildFromDataStore method with a referenced DataStore object.

PBDOM_Builder pbdom_bldr
pbdom_document pbdom_doc
datastore ds

ds = Create datastore
ds.DataObject = "d_customer"
ds.SetTransObject (SQLCA)
ds.Retrieve()

pbdom_doc = pbdom_bldr.BuildFromDataStore(ds)

In this example, a DataStore object ds is created and populated with data, and then passed to the BuildFromDataStore method. The BuildFromDataStore method causes the DataStore to export the data to XML, using the most current XML template for the DataStore, and then it uses the XML to build a PBDOM_DOCUMENT. The PBDOM_DOCUMENT object is assigned to pbdom_doc.

Usage

This method creates a temporary file in the directory pointed to by the user's TMP environment variable. If this directory is invalid, the temporary file is created in the Windows\temp directory.

The encoding specified in the XML export template has no effect on the encoding of the document created using BuildFromDataStore. It always has UTF-16LE encoding.

See also

BuildFromFile

BuildFromString