Properties can be accessed from any Oracle Commerce record returned from a navigation query (N parameter) or a record query (R parameter).
To access a property directly on an
ERec
or
AggrERec
object, use the
PropertyMap.getValues()
method (Java) or the
PropertyMap.GetValues()
method (.NET). These methods
return a collection of all the values in a record for a particular
property.
The following examples show how to access record properties.
Example 3. Java example
if (eneResults.containsNavigation()) { Navigation nav = eneResults.getNavigation(); ERecList erl = nav.getERecs(); for (int i=0; i < erl.size(); i++) { ERec erec = (ERec) erl.get(i); // Retrieve all properties from the record PropertyMap pmap = erec.getProperties(); // Retrieve all values for the property named Colors Collection colors = pmap.getValues("Colors"); Iterator it = colors.iterator(); while (it.hasNext()) { String colorValue = (String)it.next(); // Insert code to use the colorValue variable } } }
Example 4. .NET example
if (eneResults.ContainsNavigation()) { Navigation nav = eneResults.Navigation; ERecList recs = nav.ERecs; // Loop over record list for (int i=0; i<recs.Count; i++) { // Get individual record ERec rec = (ERec)recs[i]; // Get property map for record PropertyMap propsMap = rec.Properties; System.Collections.IList colors = propsMap.GetValues("Colors"); // Retrieve all values for the Colors property for (int j =0; j < colors.Count; j++) { String colorValue = (String)colors[j]; // Insert code to use the colorValue variable } } }