The Presentation API has methods and properties to retrieve rollup keys.
Assuming that you have a navigation state, the following objects and calls are used to determine the available rollup keys. These rollup keys can be used in subsequent queries to generate aggregated records:
The
Navigation.getRollupKeys()method (Java) andNavigation.RollupKeysproperty (.NET) get the rollup keys applicable for this navigation query. The rollup keys are returned as anERecRollupKeyListobject.The
ERecRollupKeyList.size()method (Java) andERecRollupKeyList.Countproperty (.NET) get the number of rollup keys in theERecRollupKeyListobject.The
ERecRollupKeyList.getKey()method (Java) andERecRollupKeyList.Itemproperty (.NET) get the rollup key from theERecRollupKeyListobject, using a zero-based index. The rollup key is returned as anERecRollupKeyobject.The
ERecRollupKey.getName()method (Java) andERecRollupKey.Nameproperty get the name of the rollup key.The
ERecRollupKey.isActive()method (Java) and theERecRollupKey.IsActive()method (.NET) returntrueif this rollup key was applied in the navigation query orfalseif it was not.
The rollup keys are retrieved from the Navigation object in an ERecRollupKeyList object. Each ERecRollupKey in this list contains the name and active status of the rollup key:
The following code fragments show how to retrieve a list of rollup keys, iterate over them, and display the names of keys that are active in the current navigation state.
Example 14. Java example for getting rollup keys
// Get rollup keys from the Navigation object
ERecRollupKeyList rllupKeys = nav.getRollupKeys();
// Loop through rollup keys
for (int i=0; i< rllupKeys.size(); i++) {
// Get a rollup key from the list
ERecRollupKey rllupKey = rllupKeys.getKey(i);
// Display the key name if the key is active.
if (rllupKey.isActive()) {
%>Active rollup key: <%= rllupKey.getName() %><%
}
}
Example 15. .NET example for getting rollup keys
// Get rollup keys from the Navigation object
ERecRollupKeyList rllupKeys = nav.RollupKeys;
// Loop through rollup keys
for (int i=0; i< rllupKeys.Count; i++) {
// Get a rollup key from the list
ERecRollupKey rllupKey = (ERecRollupKey)rllupKeys[i];
// Display the key name if the key is active.
if (rllupKey.IsActive()) {
%>Active rollup key: <%= rllupKey.Name %><%
}
}

