Xmla.Dataset.Axis Class
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
()
Item Index
Methods
Methods
eachHierarchy
-
callback. -
scope. -
args.
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:
indexintThe ordinal identifying this hierarchynamestringThe 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.ObjectThe object that will be used as scope when executing the callback function. If this is undefined or
null, the Axis'thispointer will be used. -
args.ObjectAdditional data to be passed to the callback function..
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.
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.ObjectThe object that will be used as scope when executing the callback function. If this is undefined or
null, the Axis'thispointer will be used. -
args.ObjectAdditional data to be passed as the second argument to the callback function.
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
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:
-
rowsArrayAn existing array to store the tuples in. If omitted, a new array is returned.
Returns:
fetchAllAsObject
-
rows
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:
-
rowsArrayAn existing array to store the tuples in. If omitted, a new array is returned.
Returns:
fetchAsArray
-
array
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:
-
arrayArrayAn existing array to store the members in. If omitted, a new array is returned.
Returns:
false if there are no more tuples.
fetchAsObject
-
object
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:
-
objectObjectAn existing object to store the tuple data in. If omitted, a new object is returned.
Returns:
getHierarchies
()
Array
Returns the hierarchies of this Axis object.
Returns:
getHierarchyNames
()
Array
Returns the names of the hierarchies of this Axis object.
Returns:
getTuple
()
Object
Get the current tuple as an object. The tuple object has the following structure:
indexint: the ordinal of this tuple within its axishierarchiesobject: A map of members using hierarchy names as keys, and member objects as valuesmembersarray: An array of members in order of hierarchy order.
Returns:
hasMoreHierarchies
()
Boolean
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:
true if there are more hierarchies to vist, false if all hierarchies are traversed.
hasMoreTuples
()
Boolean
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:
true if there are more tuples to vist, false if all tuples are traversed.
hierarchy
-
hierarchyIndexOrName
Gets the hierarchy identified by the specified index or hierarchyName, or the current hierarchy (in case the argument is omitted).
Parameters:
-
hierarchyIndexOrNameInt | StringThe ordinal or name of the hierarchy that is to be retrieved. When omitted, the the current hierarchy is returned.
Returns:
hierarchyCount
()
Int
Gets the number of hierarchies in this axis object.
Returns:
hierarchyIndex
-
hierarchyName
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:
-
hierarchyNameStringThe name of the hierarchy for which the index is to be retrieved. When omitted, the index of the current hierarchy is returned.
Returns:
hierarchyName
-
hierarchyIndex
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:
-
hierarchyIndexIntThe ordinal of the hierarchy for which the name is to be retrieved. When omitted, the name of the current hierarchy is returned.
Returns:
member
-
hierarchyIndexOrName
Gets the member for the specified hierarchy from the current tuple. The member has the following structure:
index-inthierarchy-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:
-
hierarchyIndexOrNameInt | StringThe ordinal or name of the hierarchy from which the member is to be retrieved. When omitted, the the current hierarchy is returned.
Returns:
nextHierarchy
()
Int
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:
nextTuple
()
Int
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:
readAsArray
-
array
Gets the current tuple as an array of members.
For a description of the structure of the member elements, see member().
Parameters:
-
arrayArrayAn existing array to store the members in. If omitted, a new array is returned.
Returns:
readAsObject
-
object
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:
-
objectObjectAn existing object to store the tuple data in. If omitted, a new object is returned.
Returns:
reset
()
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
Gets the number of tuples in this axis object.
Returns:
tupleIndex
()
Int
Returns the current value of the tuple pointer.
