You can use the following sample code to assist you in extracting rule results from Supplement objects.
// Get properties PropertyMap supPropMap = sup.getProperties(); String sProp=null; // Check if object is merchandising or // content spotlighting result if ((supPropMap.get("DGraph.SeeAlsoMerchId") != null) && (supPropMap.get("Style") != null) && (supPropMap.get("Zone") != null)) { boolean hasMerch = true; // Get record list ERecList recs = sup.getERecs(); for (int j=0; j < recs.Size(); j++) { // Get record ERec rec = (ERec)recs.get(j); // Get record Properties PropertyMap recPropsMap = rec.getProperties(); // Get value of property (e.g. Name) from current record sProp =(String)recPropsMap.get("Name"); } // Set target link using first Navigation Reference NavigationRefsList nrl = sup.getNavigationRefs(); DimValList dvl = (DimValList)nrl.get(0); // Loop over dimension values to build new target query StringBuffer sbNavParam = new StringBuffer (); for (int j=0; j < dvl.size(); j++) { DimVal dv = (DimVal)dvl.get(j) // Add delimiter and id sbNavParam.append(dv.getId()); sbNavParam.append(" "); // Get specific rule properties String style = (String)supPropMap.get("Style"); String title = (String)supPropMap.get("Title"); String zone = (String)supPropMap.get("Zone"); // This is an example of a custom Property Template // defined in the Style String customText = (String)supPropMap.get("CustomText"); Test output in JSP page %><b>%=sProp %></b><br><% %>Navigation:<%=sbNavParam.toString()%><br><% %>Style:<%=style%><br><% %>Title:<%=title%><br><% %>Zone:<%=zone%><br><% %>Text:<%=customText%><br><% } } %>
Example 95. .NET example
// Get supplement list SupplementList sups = nav.Supplements; // Loop over Supplement objects for (int i=0; i<sups.Count; i++) { // Get Supplement object Supplement sup = (Supplement)merchList[i]; // Get properties PropertyMap supPropMap = sup.Properties; // Check if Supplement object is merchandising // or content spotlighting if ((supPropMap["DGraph.SeeAlsoMerchId"] != null) && (supPropMap["Style"] != null) && (supPropMap["Zone"] != null) && (Request.QueryString["hideMerch"] == null)) { // Get Record List ERecList supRecs = sup.ERecs; // Loop over records for (int j=0; j<supRecs.Count; j++) { // Get record ERec rec = (ERec)supRecs[j]; // Get property map for record PropertyMap propsMap = rec.Properties; // Get value of name prop from current record String name = (String)propsMap["Name"]; } // Set target link using first navigation reference NavigationRefsList nrl = sup.NavigationRefs; DimValList dvl = (DimValList)nrl[0]; // Loop over dimension values to build new target query String newNavParam; for (int k=0; k<dvl.Count; k++) { DimVal dv = (DimVal)dvl[k]; // Add delimiter and id newNavParam += " "+dv.Id; } // Get specific rule properties String style = supPropMap["Style"]; String title = supPropMap["Title"]; String zone = supPropMap["Zone"]; String customText = supPropMap["CustomText"]; } }