String select = null;
StringBuilder buf = new StringBuilder();
if (sn.getWithList() != null && sn.getWithList().size() > 0) {
buf.append("WITH \n");
StringWriter sw = new StringWriter();
ParseTreeWriter ptw = new ParseTreeWriter(sw);
final PrintWriter pw = ptw.getPrintWriter();
for (ParseTreeNode with : sn.getWithList()) {
with.unparse(ptw);
pw.println();
}
buf.append(sw.toString());
}
buf.append("SELECT (");
for (int i = 0; i < cellPosition.size(); i++) {
List<Member> members = cs.getAxes().get(i).getPositions().get(cellPosition.get(i)).getMembers();
for (int k = 0; k < members.size(); k++) {
Member m = members.get(k);
if (k > 0 || i > 0) {
buf.append(", ");
}
buf.append(m.getUniqueName());
}
}
buf.append(") ON COLUMNS \r\n");
buf.append("FROM [").append(cube.getName()).append("]\r\n");
final Writer writer = new StringWriter();
sn.getFilterAxis().unparse(new ParseTreeWriter(new PrintWriter(writer)));
if (StringUtils.isNotBlank(writer.toString())) {
buf.append("WHERE ").append(writer.toString());
}
select = buf.toString();
if (maxrows > 0) {