Ejemplo n.º 1
0
  /**
   * add Top/BottomCount Funcall to QueryAxis
   *
   * @param monAx
   * @param nShow
   */
  private void topBottomAxis(ParsedQuery pq, String function) {
    // TopCount(TopCount) and TopCount(Order) is not permitted

    QueryAxis[] queryAxes = pq.getAxes();
    QueryAxis qa = queryAxes[quaxToSort.getOrdinal()];
    Exp setForAx = qa.getExp();
    Exp sortExp;
    // if we got more than 1 position member, generate a tuple
    if (sortPosMembers.length > 1) {
      sortExp = new FunCall("()", (XMLA_Member[]) sortPosMembers, FunCall.TypeParentheses);
    } else {
      sortExp = (XMLA_Member) sortPosMembers[0];
    }

    Exp[] args = new Exp[3];
    args[0] = setForAx; // the set representing the query axis
    args[1] = Literal.create(new Integer(topBottomCount));
    args[2] = sortExp;
    FunCall topbottom = new FunCall(function, args, FunCall.TypeFunction);
    qa.setExp(topbottom);
  }