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.RollupKeys
property (.NET) get the rollup keys applicable for this navigation query. The rollup keys are returned as anERecRollupKeyList
object.The
ERecRollupKeyList.size()
method (Java) andERecRollupKeyList.Count
property (.NET) get the number of rollup keys in theERecRollupKeyList
object.The
ERecRollupKeyList.getKey()
method (Java) andERecRollupKeyList.Item
property (.NET) get the rollup key from theERecRollupKeyList
object, using a zero-based index. The rollup key is returned as anERecRollupKey
object.The
ERecRollupKey.getName()
method (Java) andERecRollupKey.Name
property get the name of the rollup key.The
ERecRollupKey.isActive()
method (Java) and theERecRollupKey.IsActive()
method (.NET) returntrue
if this rollup key was applied in the navigation query orfalse
if 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 %><% } }