setIntValue (DOMElement - JavaScript)

Sets the integer value of an element.

Defined in

DOMElement

Syntax

setIntValue(value:long) : void

setIntValue(xpath:string, value:long) : void

setIntValue(xpath:string, value:long, selectionNS:NamespaceContext) : void

Parameters Description
xpath XPath of an element.
value The value to be set.
selectionNS A namespace context.

Usage

The signatures with an XPath are equivalent to setIntValue in DOMDocument.

In a schema, this data element should be defined as integer. In the data properties, the display type of a bound field should be Number.

The signatures with an XPath generate a hierarchy of elements to meet the XPath specification. For example, the specification setIntValue("/schema1/element0", 5555) generates the following XML:
<schema0>
  <element0>5555</element0>
</schema0>

The signature without an XPath sets the value for the current element as it exists in the current hierarchy.

This method replaces all content including child nodes. Append child nodes after calling this method, not before.

Examples

This example is for the onclick event of a button. It creates a document and sets a value. The requestScope variable is bound to an edit box on the page so the user specifies i before clicking the button.
var doc = database.createNewDocument();
var dom = doc.getDOM();
var schema0 = dom.createElement("schema0");
var element0 = dom.createElement("element0");
dom.appendChild(dom.createComment("DOM comment"));
dom.appendChild(schema0);
schema0.appendChild(dom.createComment("Schema comment"));
schema0.appendChild(element0);
element0.setIntValue(requestScope.i);
element0.appendChild(dom.createComment("Element comment"));
doc.save()
The generated XML is as follows:
<!--DOM comment-->
<schema0>
  <!--Schema comment-->
  <element0>5555
    <!--Element comment-->
  </element0>
</schema0>