API Docs for:
Show:

Xmla.Rowset Class

Defined in: src/Xmla.js:4436
Module: xmla

This class implements an XML/A Rowset object.

You do not need to instantiate objects of this class yourself. Rather, the Xmla class will instantiate this class to convey the result of any of the various discoverXXX() methods (see discover()). In addition, this class is also used to instantiate a Resultset for the execute() method in case the Format property is set to Tabular (see OPTION_FORMAT and OPTION_FORMAT_TABULAR). The request() method itself will also return an instance of this class in case the method is used to do a Discover request, or in case it is used to do a Execute request and the Format property is set to Tabular.

An instance of the Xmla.Rowset class is returned immediately as return value from the disoverXXX() or execute() method when doing a synchronous request. In addition, the rowset is available in the eventdata passed to any registered listeners (see addListener()). Note that for asynchronous requests, the only way to obtain the returned Rowset instance is through the listeners.

Constructor

Xmla.Rowset

(
  • node
  • requestTtype
  • xmla
)

Defined in src/Xmla.js:4436

Parameters:

  • node DOMDocument

    The responseXML result returned by server in response to a Discover request.

  • requestTtype String

    The requestType identifying the particular schema rowset to construct. This facilitates implementing field getters for a few complex types.

  • xmla Xmla

    The Xmla instance that created this Rowset. This is mainly used to allow the Rowset to access the options passed to the Xmla constructor.

Methods

close

()

Defined in src/Xmla.js:5262

Releases references to the DomDocument passed to the Rowset constructor. This should facilitate automatic garbage collection by the browser.

curr

()

Defined in src/Xmla.js:5161

Gets the value of the internal row index. Note that no check is performed to ensure this points to a valid row: you should call this function only when it is safe to do so. This can be determined by calling hasMoreRows().

Returns:

int

eachRow

(
  • callback
  • scope
  • args
)
Bool

Defined in src/Xmla.js:5128

Walks through all rows, and calls the callback function for each row.

The callback function gets passed an object that represents the row. The keys of the row object are the column names, and the values are the respective column values.

The scope for calling the callback can be passed as the second argument to this method. If the scope is not defined (or if it is null), the Rowset's this pointer is used instead.

You can pass additional data to the callback by passing in a third argument. This is then passed as is as second argument to the callback.

The eachRow method will iterate untill the callback returns false, or until all rows have been traversed. If the callback returns false, iteration is aborted and eachRow as a whole returns false too. If iteration is not aborted, then eachRow returns true.

Parameters:

  • callback Function()

    Function to be called for each row.

  • scope Object

    Optional. Scope in which the callback is called. Defaults to this, that is, the Rowset.

  • args Object

    Optional. Object that is passed as extra argument to the callback.

Returns:

Bool: true if all rows were itereated. If the callback returns false, iteration stops and false is returned.

fetchAllAsArray

(
  • rows
)
Array

Defined in src/Xmla.js:5382

Fetch all values from all fields from all rows, and return it as an array of arrays. See fetchAsArray().

Parameters:

  • rows Array

    OPTIONAL. An array to append the rows to. If not specified, a new array is created

Returns:

Array:

fetchAllAsObject

(
  • rows
)
Array

Defined in src/Xmla.js:5395

Fetch all values from all fields from all rows, and return it as an array of objects. See fetchAsObject().

Parameters:

  • rows Array

    OPTIONAL. An array to append the rows to. If not specified, a new array is created

Returns:

Array:

fetchAllCustom

(
  • rows
  • func
  • args
)
Array

Defined in src/Xmla.js:5408

Fetch all rows using a custom function, and return the return values as an array. See fetchCustom().

Parameters:

  • rows Array

    OPTIONAL. An array to append the rows to. If not specified, a new array is created

  • func Function

    a callback function to extract the fields.

  • args Object

    an object to pass data to the callback.

Returns:

Array:

fetchAsArray

() Array

Defined in src/Xmla.js:5295

Fetch all values from all fields from the current row, and return it in an array. The position of the values in the array corresponds to the column order of the rowset. The internal row pointer is also increased so the next call will read the next row. The method returns false when there are no more rows to traverse. You can use this method to drive a loop to travere all rows in the Rowset:

while (rowArray = rowset.fetchAsArray()){
    ...process array...
}

Returns:

Array:

fetchAsObject

() Object | Boolean

Defined in src/Xmla.js:5340

Fetch all values from all fields from the current row, and return it in an Object literal. The property names of the returned object correspond to the fieldName (actually the fieldLabel), and the field value is assigned to its respective property. The internal row pointer is also increased so the next call will read the next row. The method returns false when there are no more rows to traverse. You can use this method to drive a loop to travere all rows in the Rowset:

while (rowObject = rowset.fetchAsObject()){
    ...process object...
}

Returns:

Object | Boolean:

fetchCustom

(
  • func
  • args
)
Mixed | Boolean

Defined in src/Xmla.js:5362

Fetch the values using a custom callback function. If there are rows to fetch, the custom function is called in scope of the rowset, so you can use this inside the custom function to refer to the rowset object. Then, the internal row pointer is increased so the next call will read the next row. The method returns whatever object or value is returned by the custom function, or false when there are no more rows to traverse.

Parameters:

  • func Function

    a custom function to extract and return the data from the current row of the xml result.

  • args Object

    an object that will be passed to the function. Useful to hold any data required in addition to the rowset itself (which can be referred to as this inside the function).

Returns:

Mixed | Boolean:

fieldCount

() Int

Defined in src/Xmla.js:5254

Returns the number of fields in this rowset.

Returns:

Int: The number of fields in this rowset.

fieldDef

(
  • name
)
FieldDef

Defined in src/Xmla.js:5191

Retrieves a fieldDef object by name. A fieldDef describes a field (column). It has the following properties:

label
string. This is the human readable name for this field. You should use this name for display purposes and for building restrictions. This is also the name used for matching againstt the name argument passed to the fieldDef() method.
name
string. This is the (possibly escaped) name of the field as it appears in the XML document
index
int. The ordinal position of this field. Fields are numbered starting from 0.
type
string. The name of the XML data type for the values that appear in this column
minOccurs
string. The minimal number of occurrences of a value. "0" means the field is optional.
maxOccurs
string. If this is parseable as an integer, that integer specifies the number of times a value can appear in this column. "unbounded" means there is no declared limit.
getter
function. This function is used to extract a value from the XML document for this field.

Parameters:

  • name String

    The name of the field to retrieve.

Returns:

FieldDef: The fieldDef object that matches the argument.

fieldIndex

(
  • name
)
Int

Defined in src/Xmla.js:5217

Retrieves the index of a field by name. Field indexes start at 0.

Parameters:

  • name String

    The name of the field for which you want to retrieve the index.

Returns:

Int: The ordinal position (starting at 0) of the field that matches the argument.

fieldName

(
  • name
)
Int

Defined in src/Xmla.js:5227

Retrieves the name of a field by field Index. Field indexes start at 0.

Parameters:

  • name String

    The name of the field for which you want to retrieve the index.

Returns:

Int: The ordinal position (starting at 0) of the field that matches the argument.

fieldVal

(
  • name
)
Array | Boolean | Float | Int | String

Defined in src/Xmla.js:5244

Retrieves a value from the current row for the field having the name specified by the argument.

Parameters:

  • name String | int

    The name or the index of the field for which you want to retrieve the value.

Returns:

Array | Boolean | Float | Int | String: From the current row, the value of the field that matches the argument.

getFieldNames

() string

Defined in src/Xmla.js:5078

Retrieve an array of field names. The position of the names in the array corresponds to the column order of the rowset.

Returns:

string: An (ordered) array of field names.

getFields

() fieldDef

Defined in src/Xmla.js:5061

Retrieve an array of fieldDef objects that describes the fields of the rows in this rowset. The position of the fieldDef objects in the array corresponds to the column order of the rowset. For a description of the fieldDef object, see the fieldDef() method.

Returns:

fieldDef: An (ordered) array of field definition objects.

getType

()

Defined in src/Xmla.js:5051

Indicates the type of rowset. In most cases, this will be identical to the requestType value that was used in the Discover request

Returns:

int One of the DISCOVERXXX, DBSCHEMAXXX or MDSCHEMA_XXX constants

hasMoreRows

() Bool

Defined in src/Xmla.js:5090

Indicates wheter the rowset can still be traversed. You can use this method together with the nextRow() method to drive a while loop to traverse all rows in the rowset, like so:

 while(rowset.hasMoreRows()){
     ...process row...
     rowsete.nextRow();
 }
 

Returns:

Bool: true in case there are more rows to traverse. false if all rows have been traversed.

mapAllAsObject

(
  • map
)
Object

Defined in src/Xmla.js:5451

Fetch all rows as an object, store them as proprties in an object (which acts as map).

Parameters:

  • map Object

    OPTIONAL. The object that is used as map. Rows are added as properties to this map. If not specified, a new object is created

Returns:

Object:

mapAsObject

(
  • map
  • key
  • row
)
Object

Defined in src/Xmla.js:5423

Fetch all row as an object, store it in nested objects according to values in the column identified by the key argument. This method should typically not be called directly, rather it is a helper method for mapAllAsObject().

Parameters:

  • map Object
  • key Object
  • row Object

Returns:

Object: a tree using column values as branch names, and storing a row or an array of rows at the leaves.

next

()

Defined in src/Xmla.js:5120

This method is deprecated and may be removed in the future. Use nextRow() instead.

nextRow

()

Defined in src/Xmla.js:5107

Moves the internal row index to the next row. You can use this method together with the hasMoreRows() method to drive a while loop to traverse all rows in the rowset.

readAsArray

() Array

Defined in src/Xmla.js:5272

Reads the current row and returns the result as a new array. This method does not advance the internal row pointer, and does not check if there is a valid row. This method exists mainly as a convience in case you want to use a custom way to extract data from the resultset using the fetchCustom() method. If you just want to obtain the results as arrays, see fetchAsArray() and fetchAllAsArray().

Returns:

Array:

readAsObject

() Object

Defined in src/Xmla.js:5317

Reads the current row and returns the result as a new object. This method does not advance the internal row pointer, and does not check if there is a valid row. This method exists mainly as a convience in case you want to use a custom way to extract data from the resultset using the fetchCustom() method. If you just want to obtain the results as objects, see fetchAsObject() and fetchAllAsObject().

Returns:

Object:

reset

()

Defined in src/Xmla.js:5182

Resets the internal row pointer so the resultset can be traversed again.

rowCount

()

Defined in src/Xmla.js:5173

Returns the number of rows in the set.

Returns:

int

Properties

MD_DIMTYPE_ACCOUNTS

Int final static

Defined in src/Xmla.js:4532

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>6</code>

MD_DIMTYPE_BILL_OF_MATERIALS

Int final static

Defined in src/Xmla.js:4652

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>16</code>

MD_DIMTYPE_CHANNEL

Int final static

Defined in src/Xmla.js:4616

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>13</code>

MD_DIMTYPE_CURRENCY

Int final static

Defined in src/Xmla.js:4592

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>11</code>

MD_DIMTYPE_CUSTOMERS

Int final static

Defined in src/Xmla.js:4544

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>7</code>

MD_DIMTYPE_GEOGRAPHY

Int final static

Defined in src/Xmla.js:4664

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>17</code>

MD_DIMTYPE_MEASURE

Int final static

Defined in src/Xmla.js:4496

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>2</code>

MD_DIMTYPE_ORGANIZATION

Int final static

Defined in src/Xmla.js:4640

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>15</code>

MD_DIMTYPE_OTHER

Int final static

Defined in src/Xmla.js:4508

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>3</code>

MD_DIMTYPE_PRODUCTS

Int final static

Defined in src/Xmla.js:4556

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>8</code>

MD_DIMTYPE_PROMOTION

Int final static

Defined in src/Xmla.js:4628

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>14</code>

MD_DIMTYPE_QUANTITATIVE

Int final static

Defined in src/Xmla.js:4520

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>5</code>

MD_DIMTYPE_RATES

Int final static

Defined in src/Xmla.js:4604

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>12</code>

MD_DIMTYPE_SCENARIO

Int final static

Defined in src/Xmla.js:4568

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>9</code>

MD_DIMTYPE_TIME

Int final static

Defined in src/Xmla.js:4484

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>1</code>

MD_DIMTYPE_UNKNOWN

Int final static

Defined in src/Xmla.js:4472

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>0</code>

MD_DIMTYPE_UTILIY

Int final static

Defined in src/Xmla.js:4580

A possible value for the DIMENSIONTYPE column that appears in the MDSCHEMADIMENSIONS (See: discoverMDDimensions()) and MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowsets.

Default: <code>10</code>

MD_STRUCTURE_FULLYBALANCED

Int final static

Defined in src/Xmla.js:4677

A possible value for the STRUCTURE column of the MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowset.

Default: <code>0</code>

MD_STRUCTURE_NETWORK

Int final static

Defined in src/Xmla.js:4707

A possible value for the STRUCTURE column of the MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowset.

Default: <code>3</code>

MD_STRUCTURE_RAGGEDBALANCED

Int final static

Defined in src/Xmla.js:4687

A possible value for the STRUCTURE column of the MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowset.

Default: <code>1</code>

MD_STRUCTURE_UNBALANCED

Int final static

Defined in src/Xmla.js:4697

A possible value for the STRUCTURE column of the MDSCHEMA_HIERARCHIES (See: discoverMDHierarchies())rowset.

Default: <code>2</code>

MD_SYSTEM_ENABLED

Int final static

Defined in src/Xmla.js:4729

A bitmap value for the HIERARCHYORIGIN column of the MDSCHEMAHIERARCHIES (See: discoverMDHierarchies())rowset. identifies attribute hierarchies.

Default: <code>2</code>

MD_SYSTEM_INTERNAL

Int final static

Defined in src/Xmla.js:4740

A bitmap value for the HIERARCHYORIGIN column of the MDSCHEMAHIERARCHIES (See: discoverMDHierarchies())rowset. identifies attributes with no attribute hierarchies.

Default: <code>4</code>

MD_USER_DEFINED

Int final static

Defined in src/Xmla.js:4718

A bitmap value for the HIERARCHYORIGIN column of the MDSCHEMAHIERARCHIES (See: discoverMDHierarchies())rowset. Identifies user defined hierarchies.

Default: <code>1</code>

MDMEMBER_TYPE_ALL

Int final static

Defined in src/Xmla.js:4763

A possible value for the MEMBERTYPE column of the MDSCHEMAMEMBERS rowset (see: discoverMDMembers()), indicating an all member.

Default: <code>2</code>

MDMEMBER_TYPE_FORMULA

Int final static

Defined in src/Xmla.js:4774

A possible value for the MEMBERTYPE column of the MDSCHEMAMEMBERS rowset (see: discoverMDMembers()), indicating a formula member.

Default: <code>3</code>

MDMEMBER_TYPE_MEASURE

Int final static

Defined in src/Xmla.js:4785

A possible value for the MEMBERTYPE column of the MDSCHEMAMEMBERS rowset (see: discoverMDMembers()), indicating a measure member.

Default: <code>4</code>

MDMEMBER_TYPE_REGULAR

Int final static

Defined in src/Xmla.js:4752

A possible value for the MEMBERTYPE column of the MDSCHEMAMEMBERS rowset (see: discoverMDMembers()), indicating a regular member.

Default: <code>1</code>

MDMEMBER_TYPE_UNKNOWN

Int final static

Defined in src/Xmla.js:4796

A possible value for the MEMBERTYPE column of the MDSCHEMAMEMBERS rowset (see: discoverMDMembers()), indicating a member of unknown type

Default: <code>0</code>