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
- eachHierarchy
- eachTuple
- fetchAllAsArray
- fetchAllAsObject
- fetchAsArray
- fetchAsObject
- getHierarchies
- getHierarchyNames
- getTuple
- hasMemberProperty
- hasMoreHierarchies
- hasMoreTuples
- hierarchy
- hierarchyCount
- hierarchyIndex
- hierarchyName
- member
- nextHierarchy
- nextTuple
- readAsArray
- readAsObject
- reset
- tupleCount
- tupleIndex
Properties
- MDDISPINFO_CHILDREN_CARDINALITY static
- MDDISPINFO_DRILLED_DOWN static
- MDDISPINFO_SAME_PARENT_AS_PREV static
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:
-
callbackFunction()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().
-
scopeObjectThe object that will be used as scope when executing the callback function. If this is undefined or
null, the Axis'thispointer will be used. -
argsObjectAdditional data to be passed to the callback function..
Returns:
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:
-
callbackFunction()A function that will be called for each tuple. The tuple is passed as an object as the first argument to the callback.
-
scopeObjectThe object that will be used as scope when executing the callback function. If this is undefined or
null, the Axis'thispointer will be used. -
argsObjectAdditional data to be passed as the second argument to the callback function.
Returns:
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:
An array of arrays representing all tuples that belong to this axis.
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:
An array of arrays representing all tuples that belong to this axis.
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:
An array of members that represents the current tuple, or 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:
An object that represents the current tuple.
getHierarchies
()
Array
Returns the hierarchies of this Axis object.
Returns:
An array of hierarchies contained in this Axis.
getHierarchyNames
()
Array
Returns the names of the hierarchies of this Axis object.
Returns:
An array of names of the hierarchies contained in this Axis.
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:
An object representing the current tuple..
hasMemberProperty
-
propertyName
Check if the member has the specified property. XML/A defines these standard properties:
UNameCaptionLNameLNumDisplayInfo
Parameters:
-
propertyNameStringThe name of the property to check for.
Returns:
returns true if the current member has the specified property, false if it doesn't.
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:
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:
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). 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.
- 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:
-
hierarchyIndexOrNameInt | StringThe ordinal or name of the hierarchy that is to be retrieved. When omitted, the the current hierarchy is returned.
Returns:
The hierarchy specified by the argument index or name, or the current hierarchy if the argument is omitted.
hierarchyCount
()
Int
Gets the number of hierarchies in this axis object.
Returns:
Returns the number of hierarchies in this Axis object.
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:
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
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:
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
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. 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:
-
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:
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
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:
Returns the index of current hierarchy.
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:
Returns the index of current tuple.
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:
An array of members that represents the current tuple.
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:
An object that represents the current tuple.
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:
Returns the number of tuples in this Axis object.
tupleIndex
()
Int
Returns the current value of the tuple pointer.
Returns:
Returns the current value of the tuple pointer.
Properties
MDDISPINFO_CHILDREN_CARDINALITY
Int
final
static
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
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
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>
