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) and Navigation.RollupKeys property (.NET) get the rollup keys applicable for this navigation query. The rollup keys are returned as an ERecRollupKeyList object.
- The ERecRollupKeyList.size() method (Java) and ERecRollupKeyList.Count property (.NET) get the number of rollup keys in the ERecRollupKeyList object.
- The ERecRollupKeyList.getKey() method (Java) and ERecRollupKeyList.Item property (.NET) get the rollup key from the ERecRollupKeyList object, using a zero-based index. The rollup key is returned as an ERecRollupKey object.
- The ERecRollupKey.getName() method (Java) and ERecRollupKey.Name property get the name of the rollup key.
- The ERecRollupKey.isActive() method (Java) and the ERecRollupKey.IsActive() method (.NET) return true if this rollup key was applied in the navigation query or false 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 name is used to specify the rollup key in a subsequent navigation or aggregated record query.
- The active status indicates whether the rollup key was applied to the current query.
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.
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() %><%
}
}
.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 %><%
}
}