API Docs for:
Show:

Xmla.Dataset.Axis Class

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

This class implements an Axis object.

You do not need to instantiate objects of this class yourself. Rather, the Xmla.Dataset class creates instances of this class to represent the axes of an MDX query. (see getAxis().)

Constructor

Xmla.Dataset.Axis

()

Defined in ../src/Xmla.js:5984

Methods

eachHierarchy

(
  • callback
  • scope
  • args
)
Boolean

Defined in ../src/Xmla.js:6177

Calls a callback function for each hierarchy in this Axis object.

The callback function is passed an object that represents the current hierarchy. This object has the following structure:

  • index int The ordinal identifying this hierarchy
  • name string The name of this hierarchy

The callback may return false to abort iteration. If the callback does not return false, iteration will resume until all hierarchies are traversed.

Parameters:

  • callback Function()

    A function that will be called for each hierarchy. The hierarchy is passed as an object as the first argument to the callback. For the structure of the hierarchy object, see hierarchy().

  • scope Object

    The object that will be used as scope when executing the callback function. If this is undefined or null, the Axis' this pointer will be used.

  • args Object

    Additional data to be passed to the callback function..

Returns:

Boolean:

Returns true if all hierarchies were visited and the callback did not return false. Returns false if the callback returned false and further iteration was aborted.

eachTuple

(
  • callback
  • scope
  • args
)
Boolean

Defined in ../src/Xmla.js:6264

Calls a callback function for each tuple in this Axis object.

The callback function is passed an object that represents the current tuple. (see getTuple() for a description of the tuple format.)

The callback may return false to abort iteration. If the callback does not return false, iteration will resume until all tuples are traversed.

Parameters:

  • callback Function()

    A function that will be called for each tuple. The tuple is passed as an object as the first argument to the callback.

  • scope Object

    The object that will be used as scope when executing the callback function. If this is undefined or null, the Axis' this pointer will be used.

  • args Object

    Additional data to be passed as the second argument to the callback function.

Returns:

Boolean:

Returns true if all tuples were visited and the callback did not return false. Returns false if the callback returned false and further iteration was aborted.

fetchAllAsArray

(
  • rows
)
[array]

Defined in ../src/Xmla.js:6532

Fetches all tuples and returns them as an array of arrays. Each element of the returned array is an array of member objects. For a description of the structure of the member elements, see member().

Parameters:

  • rows Array

    An existing array to store the tuples in. If omitted, a new array is returned.

Returns:

[array]:

An array of arrays representing all tuples that belong to this axis.

fetchAllAsObject

(
  • rows
)
[object]

Defined in ../src/Xmla.js:6547

Fetches all tuples and returns them as an array of objects. Each element of the returned array is a tuple object. The object's keys are the hierarchy names, and the members of the current tuple are used as values for the keys. For a description of the structure of the member elements, see member().

Parameters:

  • rows Array

    An existing array to store the tuples in. If omitted, a new array is returned.

Returns:

[object]:

An array of arrays representing all tuples that belong to this axis.

fetchAsArray

(
  • array
)
Array | False

Defined in ../src/Xmla.js:6501

Gets the current tuple as an array of members and advances the internal tuple pointer. For a description of the structure of the member elements, see member().

Parameters:

  • array Array

    An existing array to store the members in. If omitted, a new array is returned.

Returns:

Array | False:

An array of members that represents the current tuple, or false if there are no more tuples.

fetchAsObject

(
  • object
)
Object

Defined in ../src/Xmla.js:6516

Gets the current tuple as an object and advances the current tuple pointer. The object's keys are the hierarchy names, and the members of the current tuple are used as values for the keys. For a description of the structure of the member elements, see member().

Parameters:

  • object Object

    An existing object to store the tuple data in. If omitted, a new object is returned.

Returns:

Object:

An object that represents the current tuple.

getHierarchies

() Array

Defined in ../src/Xmla.js:6290

Returns the hierarchies of this Axis object.

Returns:

Array:

An array of hierarchies contained in this Axis.

getHierarchyNames

() Array

Defined in ../src/Xmla.js:6298

Returns the names of the hierarchies of this Axis object.

Returns:

Array:

An array of names of the hierarchies contained in this Axis.

getTuple

() Object

Defined in ../src/Xmla.js:6243

Get the current tuple as an object. The tuple object has the following structure:

  • index int: the ordinal of this tuple within its axis
  • hierarchies object: A map of members using hierarchy names as keys, and member objects as values
  • members array: An array of members in order of hierarchy order.

Returns:

Object:

An object representing the current tuple..

hasMemberProperty

(
  • propertyName
)
Boolean

Defined in ../src/Xmla.js:6457

Check if the member has the specified property. XML/A defines these standard properties:

  • UName
  • Caption
  • LName
  • LNum
  • DisplayInfo
The XML/A provider may return specific additional properties.

Parameters:

  • propertyName String

    The name of the property to check for.

Returns:

Boolean:

returns true if the current member has the specified property, false if it doesn't.

hasMoreHierarchies

() Boolean

Defined in ../src/Xmla.js:6157

Checks if there are more hierarchies to iterate through. You can use this method along with the nextHierarchy() method to drive a loop to iterate through the hierarchies contained in this axis object.

Returns:

Boolean:

Returns true if there are more hierarchies to vist, false if all hierarchies are traversed.

hasMoreTuples

() Boolean

Defined in ../src/Xmla.js:6205

Checks if there are more tuples to iterate through. You can use this method along with the nextTuple() method to drive a loop to iterate through the tuples contained in this axis object.

Returns:

Boolean:

Returns true if there are more tuples to vist, false if all tuples are traversed.

hierarchy

(
  • hierarchyIndexOrName
)
String

Defined in ../src/Xmla.js:6351

Gets the hierarchy identified by the specified index or hierarchyName, or the current hierarchy (in case the argument is omitted). The hierarchy is returned as an object with the following properties:

  • index {int} Integer indicating the ordinal position of this hiearchy within the axis.
  • name {string} String that holds the name of this hierarchy.
In addition, the XML/A specification suggests the following standard properties:
  • UName {string} the unique name of this hierarchy
  • Caption {string} the human friendly name for this hierarchy
  • LName {string} the level name
  • LNum {int} the level number
  • DisplayInfo {int} displayinfo

Parameters:

  • hierarchyIndexOrName Int | String

    The ordinal or name of the hierarchy that is to be retrieved. When omitted, the the current hierarchy is returned.

Returns:

String:

The hierarchy specified by the argument index or name, or the current hierarchy if the argument is omitted.

hierarchyCount

() Int

Defined in ../src/Xmla.js:6308

Gets the number of hierarchies in this axis object.

Returns:

Int:

Returns the number of hierarchies in this Axis object.

hierarchyIndex

(
  • hierarchyName
)
Int

Defined in ../src/Xmla.js:6316

Gets the index of the hierarchy identified by the specified name, or the index of the current hierarchy (in case the name argument is omitted).

Parameters:

  • hierarchyName String

    The name of the hierarchy for which the index is to be retrieved. When omitted, the index of the current hierarchy is returned.

Returns:

Int:

The index of the hierarchy specified by the name passed as argument, or the index of the current hierarchy if the name argument is omitted.

hierarchyName

(
  • hierarchyIndex
)
String

Defined in ../src/Xmla.js:6333

Gets the name of the hierarchy identified by the specified index, or the name of the current hierarchy (in case the index argument is omitted).

Parameters:

  • hierarchyIndex Int

    The ordinal of the hierarchy for which the name is to be retrieved. When omitted, the name of the current hierarchy is returned.

Returns:

String:

The name of the hierarchy specified by the argument index, or the name of the current hierarchy if the index argument is omitted.

member

(
  • hierarchyIndexOrName
)
Object

Defined in ../src/Xmla.js:6392

Gets the member for the specified hierarchy from the current tuple. The member has the following structure:

  • index - int
  • hierarchy - string. Name of the hiearchy to which this member belongs.
  • UName - string. Unique name of this member.
  • Caption - string. Human friendly name for this member.
  • LName - string. Name of the level to which this member belongs.
  • LNum - int. Number of the level to which this member belongs. Typically, the top-level is level 0, its children are level 1 and so on.
  • DisplayInfo - int. A 4 byte value. The 2 least significant bytes form a 16 bit integer that conveys the number of children of this member. The remaining two most significant bytes form a 16 bit bitfield.

The index and hierarchy properties are non standard and always added by Xmla4js. The properties UName, Caption, LName and LNum are defined by the XML/A standard, and should always be present. The property DisplayInfo is non-standard, but often available. Other properties may be present depending on the specific XML/A provider.

Parameters:

  • hierarchyIndexOrName Int | String

    The ordinal or name of the hierarchy from which the member is to be retrieved. When omitted, the the current hierarchy is returned.

Returns:

Object:

The member of the current tuple that belongs to the specified hierarchy, If the argument is omitted the member that belongs current hierarchy is retrieved from the current tuple.

nextHierarchy

() Int

Defined in ../src/Xmla.js:6167

Moves the internal hierarchy pointer forward. You can use this method along with the hasMoreHierarchies() method to drive a loop to iterate through the hierarchies contained in this axis object.

Returns:

Int:

Returns the index of current hierarchy.

nextTuple

() Int

Defined in ../src/Xmla.js:6215

Moves the internal tuple pointer forward. You can use this method along with the nextTuple() method to drive a loop to iterate through the tuples contained in this axis object.

Returns:

Int:

Returns the index of current tuple.

readAsArray

(
  • array
)
Array

Defined in ../src/Xmla.js:6474

Gets the current tuple as an array of members. For a description of the structure of the member elements, see member().

Parameters:

  • array Array

    An existing array to store the members in. If omitted, a new array is returned.

Returns:

Array:

An array of members that represents the current tuple.

readAsObject

(
  • object
)
Object

Defined in ../src/Xmla.js:6487

Gets the current tuple as an object. The object's keys are the hierarchy names, and the members of the current tuple are used as values for the keys. For a description of the structure of the member elements, see member().

Parameters:

  • object Object

    An existing object to store the tuple data in. If omitted, a new object is returned.

Returns:

Object:

An object that represents the current tuple.

reset

()

Defined in ../src/Xmla.js:6146

Resets this axis object. This resets internal counters for iterating through the hierarchies and tuples of this Axis object. When using hierarchy and tuple iterators to traverse the entire axis, you typically won't need to call this method yourself.

tupleCount

() Int

Defined in ../src/Xmla.js:6227

Gets the number of tuples in this axis object.

Returns:

Int:

Returns the number of tuples in this Axis object.

tupleIndex

() Int

Defined in ../src/Xmla.js:6235

Returns the current value of the tuple pointer.

Returns:

Int:

Returns the current value of the tuple pointer.

Properties

MDDISPINFO_CHILDREN_CARDINALITY

Int final static

Defined in ../src/Xmla.js:6010

A constant that can be used as a bitmask for a member's DisplayInfo property. Bitwise AND-ing this mask to the member's DisplayInfo property returns an estimate of the number of children of this member.

Default: 65535

MDDISPINFO_DRILLED_DOWN

Int final static

Defined in ../src/Xmla.js:6020

A constant that can be used as a bitmask for a member's DisplayInfo property. If this bit is set, it means the member is drilled down. This is the case whenever at least one child of this member appears on the axis immediately following this member.

Default: <code>1</code>

MDDISPINFO_SAME_PARENT_AS_PREV

Int final static

Defined in ../src/Xmla.js:6031

A constant that can be used as a bitmask for a member's DisplayInfo property. If this bit is set, it means this member has the same parent as the member immediately preceding this member.

Default: <code>1</code>