getDoubleValues (DOMElement - JavaScript)
Gets the double value of a data element.
Defined in
DOMElementSyntax
getDoubleValues(xpath:string) : double[]
getDoubleValues(xpath:string, selectionNS:NamespaceContext)
: double[]
Parameters | Description |
---|---|
xpath |
The XPath of elements associated with the document. |
selectionNS |
A namespace context. |
Return value | Description |
---|---|
double[] |
The data values of the elements. |
Usage
This method is equivalent to getDoubleValues in DOMDocument.In a schema,
these data elements should be defined as double
.
In the data properties, the display type of a bound field should be Number
.
If
the XPath includes namespace prefixes, either:
- Define the namespaces in the second parameter, first creating a new DOMNamespaceContextImpl object and adding the namespaces with addNamespace.
- Define the namespaces with setSelectionNamespaces before using this method without the second parameter.
Examples
(1) This example is for theonclick
event
of a button. It gets elements from the document specified by an index.
The requestScope
variables are bound to edit boxes
on the page so the user specifies i
before clicking
the button, and gets back y
or msg
.var dc = database.getAllDocuments();
if(dc.getDocumentCount() > 0) {
if(requestScope.i != null &&
requestScope.i >= 0 &&
requestScope.i < dc.getDocumentCount()) {
var ar = dc.getDocumentArray(requestScope.i + 1);
var doc = ar[i];
var elem = doc.getDocumentElement();
requestScope.y = elem.getDoubleValues("/schema0/element2").join(", ");
} else {
requestScope.msg = "No such document";
}
} else {
requestScope.msg = "No documents in database";
}
(2) This example is for the
onclick
event
of a button. It gets elements from the document specified by an index
using namespaces. The requestScope
variables are
bound to edit boxes on the page so the user specifies i
before
clicking the button, and gets back y
or msg
.var dc = database.getAllDocuments();
if(dc.getDocumentCount() > 0) {
if(requestScope.i != null &&
requestScope.i >= 0 &&
requestScope.i < dc.getDocumentCount()) {
var ns = new NamespaceContextImpl();
ns.addNamespace("p", "http://mynamespace.com");
var ar = dc.getDocumentArray(requestScope.i + 1);
var doc = ar[i];
var elem = doc.getDocumentElement();
requestScope.y = elem.getDoubleValues("/p:schema0/p:element2", ns).join(", ");
} else {
requestScope.msg = "No such document";
}
} else {
requestScope.msg = "No documents in database";
}