mysticfall / pivot4j

Pivot4J provides a common API for OLAP servers which can be used to build an analytical service frontend with pivot style GUI.
Other
128 stars 101 forks source link

Navigate to unexpected screen(message) when click on drill down button. #171

Closed chandankarpankaj closed 9 years ago

chandankarpankaj commented 9 years ago

Navigate to unexpected screen(message) when click on drill down button.

Screen : "You need to put at least one level or measure on Columns and Rows for a valid query. You can drag elements from the cube structure and drop them on either axes in the pivot structure view."

Steps to reproduce : when user already drilled down at the last level of any hierarchy and again click on any drill-down (-->) arrow. before_drill_down_on_q2 after_drill_down_on_q2

Suggestion/ Solution : Please change the method "public Void execute(PivotModel model, CellParameters parameters)" of the class DrillDownReplaceCommand as below to fix :

@Override public Void execute(PivotModel model, CellParameters parameters) { CellSet cellSet = model.getCellSet();

    CellSetAxis axis = cellSet.getAxes().get(parameters.getAxisOrdinal());
    Position position = axis.getPositions().get(
            parameters.getPositionOrdinal());

    // ID 56253 SIM_Iteration-I  Story 2 -Exception error displayed when click on drill down button.
    int memOrdinal = parameters.getMemberOrdinal();
    Member member = null;
    if(memOrdinal != -1)
    {
        member = position.getMembers().get(memOrdinal);
    }else{
        member = position.getMembers().get(0).getParentMember();

        FacesContext context = FacesContext.getCurrentInstance();
        String title = String
                .format("No further drill down is available.");
        String message = String
                .format("No further drill down is available.");
        context.addMessage(null, new FacesMessage(
                FacesMessage.SEVERITY_WARN, title, message));
    }

    DrillReplace transform = model.getTransform(DrillReplace.class);
    transform.drillDown(member);

    return null;
}
mysticfall commented 9 years ago

Wow... thanks much for the detailed report and even the suggestion of how to fix it :)

I'll try to investigate the problem in couple of days and update the issue status accordingly.

mysticfall commented 9 years ago

The cause of the problem was the incorrect member ordinal as your suggestion proved. However, I thought it'd be less confusing if we could just disable the drill down control in such cases so I fixed this in a slightly different way.

Thanks for bringing this up!