API Docs for:
Show:

Xmla.Dataset.Axis Class

Defined in: src/Xmla.js:5877
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:5877

Methods

eachHierarchy

(
  • callback.
  • scope.
  • args.
)
Boolean

Defined in src/Xmla.js:5992

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.

  • 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:6079

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:6327

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:6341

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:6296

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:6311

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:6105

Returns the hierarchies of this Axis object.

Returns:

Array: An array of hierarchies contained in this Axis.

getHierarchyNames

() Array

Defined in src/Xmla.js:6113

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:6058

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..

hasMoreHierarchies

() Boolean

Defined in src/Xmla.js:5972

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:6020

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:6166

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

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:6123

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:6131

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:6148

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:6196

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.

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:5982

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:6030

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:6269

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:6282

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:5961

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:6042

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:6050

Returns the current value of the tuple pointer.

Returns:

Int: Returns the current value of the tuple pointer.