The Navigation and Dimension classes have methods for getting descriptor dimensions and their dimension values.

To retrieve descriptor dimension values:

  1. Access the Navigation object from the query results object.

  2. After the application has retrieved the Navigation object, retrieve a list of dimensions (a DimensionList object) that contain descriptors with:

    These calls return descriptor dimension values.

    An alternative way is to use:

    These calls return a list of dimension groups (a DimGroupList object) instead of a list of dimensions. Each dimension group then contains a list of one or more dimensions with descriptors.

    If one of the descriptors is a hierarchical ancestor of another, the MDEX Engine consolidates descriptors into single dimensions. The only exception to this is when a dimension is marked for multi-select. When a dimension is marked for multi-select and or multi-select or, the consolidation is not made and each descriptor gets its own dimension object.

  3. Once a descriptor dimension has been retrieved, use these calls to extract various selected dimension value information from the dimension:

Example 40. Examples: retrieving and rendering descriptors

Java example of retrieving descriptors:

Navigation nav = ENEQueryResults.getNavigation();
// Get list of the dimensions with descriptors
DimensionList dl = nav.getDescriptorDimensions();
// Loop through the list
for (int I=0; I < dl.size(); I++) {
  // Get a dimension from the list
  Dimension d = (Dimension)dl.get(I);
  // Get the descriptor and then its name and ID
  DimVal desc = d.getDescriptor();
  String descName = desc.getName();
  long descId = desc.getId();
  // Get list of descriptor’s ancestors and their info
  DimValList ancs = d.getAncestors();
  for (int J=0; J < ancs.size(); J++) {
    DimVal anc = (DimVal)ancs.get(J);
    String ancName = anc.getName();
    long ancId = anc.getId();
  }
}

.NET example of retrieving descriptors:

Navigation nav = ENEQueryResults.Navigation;
// Get list of the dimensions with descriptors
DimensionList dl = nav.DescriptorDimensions;
// Loop through the list
for (int I=0; I < dl.Count; I++) {
  // Get a dimension from the list
  Dimension d = (Dimension)dl[I];
  // Get the descriptor and then its name and ID
  DimVal desc = d.Descriptor;
  string descName = desc.getName();
  long descId = desc.Id;
  // Get list of descriptor’s ancestors and their info
  DimValList ancs = d.Ancestors;
  for (int J=0; J < ancs.Count; J++) {
    DimVal anc = (DimVal)ancs[J];
    String ancName = anc.Name;
    long ancId = anc.Id;
  }
}

Java example of rendering descriptors:

<table>
<%
Navigation nav = ENEQueryResults.getNavigation();
DimensionList dl = nav.getDescriptorDimensions();
for (int I=0; I < dl.size(); I++) {
  Dimension d = (Dimension)dl.get(I);
  %> <tr>
  <%
  DimValList ancs = d.getAncestors();
  for (int J=0; J < ancs.size(); J++) {
    DimVal anc = (DimVal)ancs.get(J);
    %> <td><%= anc.getName() %>
<%
  }
  DimVal desc = d.getDescriptor();
  %> <td><%= desc.getName() %></td></tr>
  <%
}
%>
</table>

.NET example of rendering descriptors:

<table>
<%
Navigation nav = ENEQueryResults.Navigation;
DimensionList dl = nav.DescriptorDimensions;
for (int I=0; I < dl.Count; I++) {
  Dimension d = (Dimension)dl[I];
  %> <tr>
  <%
  DimValList ancs = d.Ancestors;
  for (int J=0; J < ancs.Count; J++) {
    DimVal anc = (DimVal)ancs[J];
    %> <td><%= anc.Name %>
<%
  }
  DimVal desc = d.Descriptor;
  %> <td><%= desc.Name %></td></tr>
  <%
}
%>
</table>



Copyright © Legal Notices