create new ChangeSlicer extension

Help
2009-01-29
2013-04-29
  • superbeppe77

    superbeppe77 - 2009-01-29

    Hi,

    I had the need to extend the behaviour of Jpivot to support multi selection in slicer.

    I changed SlicerCategory class, create a new extension of the MondrianChangeSlicer and registered in config.xml.

    In my MondrianChangeSlicer extension I use removeFormula and addFormula over the query so I can update the formula when user changes the selection.
    All works fine when I use that formula in slicer axis but I have a problem of caching when I put it in column or row axis.

    In fact the result shows the value related to the first selection made (=first addFormula made).

    The following is relevant piece of code:

    monQuery.removeFormula(memberKey, false);
    Exp fc = new UnresolvedFunCall("Aggregate", Syntax.Function,new
           Exp[] { new UnresolvedFunCall("{}", Syntax.Braces,    exprItems) });
    monQuery.addFormula((Id) monQuery.getConnection().parseExpression(
                    memberKey), fc, new MemberProperty[0]);
    UnresolvedFunCall ufc = new UnresolvedFunCall("()", Syntax.Parentheses,
                    monExpr);
    monQuery.setSlicerAxis(new QueryAxis(false, ufc, AxisOrdinal.SLICER,
                    QueryAxis.SubtotalVisibility.Undefined));
    ((MondrianModel) getModel()).fireModelChanged();

    Please, help!

    Bye

    Andrea

     
    • superbeppe77

      superbeppe77 - 2009-02-01

      I wrote this example to explain better my problem:

      1) in the first interaction user chooses two elements of dimension Block (Blocage général, Blocage liquidité) as filter
      and my code create the following query

      with member [Block].[All Blocage].[Some] as 'Aggregate({[Block].[All Blocage].[Blocage général], [Block].[All Blocage].[Blocage liquidité]})'
      select {[Measures].[NumberOfClients]} ON COLUMNS,
        {[LoadingDate].CurrentMember} ON ROWS
      from [Client]
      where [Block].[All Blocage].[Some]

      Result: NumberOfClients=7

      2) then user chooses two elements of dimension Block (Some, Non bloqué) as filter
      and my code create the following query

      with member [Block].[All Blocage].[Some] as 'Aggregate({[Block].[All Blocage].[Non bloqué], [Block].[All Blocage].[Blocage général], [Block].[All Blocage].[Blocage liquidité]})'
      select {[Measures].[NumberOfClients]} ON COLUMNS,
        {[LoadingDate].CurrentMember} ON ROWS
      from [Client]
      where [Block].[All Blocage].[Some]

      Result: NumberOfClients=975

      Here all works fine but when I put dimension Block in the row I have a wrong result

      3) user brings Block on row and selects Some member
      query created is correct:

      with member [Block].[All Blocage].[Some] as 'Aggregate({[Block].[All Blocage].[Non bloqué], [Block].[All Blocage].[Blocage général], [Block].[All Blocage].[Blocage liquidité]})'
      select {[Measures].[NumberOfClients]} ON COLUMNS,
        {([LoadingDate].[All LoadingDates], [Block].[All Blocage].[Some])} ON ROWS
      from [Client]

      Result: NumberOfClients=7 but the value expected is 975

      I don't understand where is my mistake or what lines of code I miss.

      May anyone helps me?

      Bye

      Andrea

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks