Tuple Expressions (MDX)
Details
In InterSystems MDX, a tuple expression can have either of the following forms:
-
A tuple literal, which is a comma-separated list of member expressions, enclosed by parentheses:
(member_expr1, member_expr2, member_expr3, ...)
Where member_expr1, member_expr2, member_expr3, and so on are member expressions. The parentheses are required.
-
A reference to a pivot variable that contains a tuple literal. To refer to a pivot variable, use the following syntax:
$VARIABLE.variablename
Where variablename is the logical variable name. Do not enclose this expression with square brackets. This syntax is not case-sensitive; nor is the pivot variable name.
For information on defining pivot variables, see Defining and Using Pivot Variables.
Notes and Additional Terminology
In other implementations of MDX, a tuple cannot include more than one member from the same dimension. In InterSystems MDX, a tuple expression can include more than one member expression from the same dimension. In most cases, the result is null. However, in Business Intelligence, a level can be based on a list value, which means that a given record can belong to multiple members. For example, the tuple (allerd.soy,allerd.wheat) represents all patients who are allergic to both soy and wheat, and this tuple could potentially have a non-null value.
If the tuple refers to each dimension in the cube, the tuple is fully qualified. Otherwise, it is partially qualified. The following shows an example of a partially qualified tuple from the Patients cube:
(allerd.[dairy products], colord.red, aged.35)
Another partially qualified tuple is as follows:
(diagd.asthma, aged.[age group].[30 to 59], MEASURES.[%COUNT])
Also, note that each data cell returned by a query is a tuple.
The CROSSJOIN function returns a set of tuples, as does the NONEMPTYCROSSJOIN function.
Uses
You can use tuple expressions in the following ways: