Roles
You can also create expressions that refer
to roles instead of query items. You must use the roleValue
function
to refer to a particular role. For example, you want to query against
a specific role in a hierarchy but the query item playing that role
is different at each level of the hierarchy. A single query can span
the different query items at each level. You can also use the roleValue
function
when you know the role but not the underlying query item.
You can assign multiple roles to one query item, but the same role cannot be assigned to different query items in the same level.
Default roles are pre-defined for all parent-child hierarchies and for all levels in level-based hierarchies. Most of these roles are not visible in the IBM Cognos studios.
The roles that are reserved by IBM Cognos Analytics start with an underscore. The name for a custom role cannot start with an underscore.
Default roles
The default roles include the following:
- _businessKey
Represents the key for the level. The level can be defined as unique if the business key of the level is sufficient to identify each set of data for a level.
The _businessKey role can be assigned to only one attribute in a level.
The Root Business Key property shows the value of the business key for the root member. The root member is an artificial level created for dimensionally modeled relational models. To enable drill-through on conforming dimensions, you must set the Root Business Key property.
- _memberCaption
Presents the caption for a member that will be shown in the IBM Cognos studios.
The _memberCaption role is necessary to leverage member functions and to enable dragging and dropping levels in the IBM Cognos studios.
Ensure that the data type is set to string for the item that will be assigned the _memberCaption role.
- _memberDescription
Returns the description for a member within a dimension.
Custom roles
By default, attributes are included with no role. You can assign attributes to existing roles or you can create custom roles. Each role that you create must have a unique name.
You can translate the custom roles in the model.