2 Replies Latest reply: Oct 8, 2012 10:01 AM by TimK RSS

    Finding Max of Dimension values

      Hi ,

      I want to find the Maximum value of a parituclar dimension( ex: TopSellers dimension has values like 100,200,700,300 etc.).

      What could be the query parameter that we can use while querying.

        • 1. Re: Finding Max of Dimension values
          Pravin Chikhale
          You can get the record count for that dimension using same query. No additional parameter required.

          Enable compute refinement statistics in Advanced tab (Developer studio) for that dimension and use Dgraph.Bins property to get the record count.
          But this will return you the record count for the current navigation state or searched result tagged to that particular dimension.

          Please refer Basic Dev Guide for more detailed information.


          • 2. Re: Finding Max of Dimension values
            Hello Unnam,

            If you are in a situation where you have too many refinement values to return just for the purposes of getting the min/max values or you are using the "More..." functionality and sorting alphabetically, there is another feature that will allow you to get min/max and other values - analytics queries. This may require additional licensing from Oracle, you'll have to check.

            For the details:
            Your analytics query will be very simple compared to what's in the guide above.

            Analytics need to be enabled in the ./MDEX/6.X.X/conf/ProductConfig.xml file, adding the following line within the <PRODUCT_CONFIG> element:
            <FEATURE NAME="Analytics API" ENABLE="TRUE"/>

            The following is an example Analytics statement that can be used to capture the min and max value for the p_Fee property in a given navigation state:
            RETURN FeeStmt AS SELECT MIN(p_Fee) AS MinFee, MAX(p_Fee) AS MaxFee GROUP

            This statement can be added to the basic ENEQuery object in the application code as in the following example:
            ENEQuery query = ...
            String analyticsFeeStr = "RETURN FeeStmt AS SELECT MIN(p_Fee) AS MinFee, MAX(p_Fee) AS MaxFee GROUP";
            AnalyticsQuery analytics = AnalyticsQuery.parseQuery(analyticsFeeStr);

            The results can be retrieved from the returned Navigation object using Navigation.getAnalyticsStatementResult(), as in the following example:
            Navigation nav = ...
            AnalyticsStatementResult analyticsFeeResult = nav.getAnalyticsStatementResult("FeeStmt");
            long numAnalyticsERecs = analyticsFeeResult.getReturnedNumERecs();
            String minFee = "";
            String maxFee = "";
            if (numAnalyticsERecs > 0) {
            ERec analyticsFeeERec = (ERec) analyticsFeeResult.getERecIter().next();
            minFee = (String) analyticsFeeERec.getProperties().get("MinFee");
            maxFee = (String) analyticsFeeERec.getProperties().get("MaxFee");