Displaying derived properties in the UI is similar to displaying regular properties.
The Presentation API’s semantics for a derived property are similar to those of regular properties, though there are a few differences. Derived properties apply only to aggregated Oracle Commerce records. Therefore, the MDEX Engine query must be properly formulated to include a rollup key.
Use the following calls to work with the aggregated record (an AggERec
object):
API method or property |
Purpose |
---|---|
Java: .NET: |
Returns a |
Java: .NET: |
Returns an |
The following code examples demonstrate how to display the names and values of an aggregated record’s derived properties.
Example 55. Java example of displaying derived properties
// Get aggregated record list AggrERecList aggrecs = nav.getAggrERecs(); for (int i=0; i<aggrecs.size(); i++) { // Get individual aggregated record AggrERec aggrec = (AggrERec)aggrecs.get(i); // Get all derived properties. PropertyMap derivedProps = aggrRec.getProperties(); Iterator derivedPropIter = derivedProps.entrySet().iterator(); // Loop over each derived property, // handle as an ordinary property. while (derivedPropIter.hasNext()) { Property prop = (Property) derivedPropIter.next( ); // Display property %> <tr> <td>Derived property name: <%= prop.getKey() %></td> <td>Derived property value: <%= prop.getValue() %></td> </tr> <% } }
Example 56. .NET example of displaying derived properties
Get aggregated record list AggrERecList aggrecs = nav.AggrERecs; // Loop over aggregated record list for (int i=0; i<aggrecs.Count; i++) { // Get an individual aggregated record AggrERec aggrec = (AggrERec)aggrecs[i]; // Get all derived properties. PropertyMap derivedPropsMap = aggrec.Properties; // Get property list for agg record System.Collections.IList derivedPropsList = derivedPropsMap.EntrySet; // Loop over each derived property, // handle as an ordinary property. foreach (Property derivedProp in derivedPropsList) { // Display property %> <tr><td>Derived property name: <%= derivedProp.Key %></td> <td>Derived property value: <%= derivedProp.Value %></td></tr> <% } }