2 Replies Latest reply: Feb 8, 2012 12:21 PM by Rogerio Faria RSS

    SetExpression using variables not ignoring Current Selecion

      Hi all,

       

      I have two Variables to calculate a result, its like this:

       

      vResultReal =

         if(TipoAcumulo='Soma',

            sum(RealizadoIndicadores)/sum(MetaIndicadores),

            if(TipoAcumulo='Media',

               avg(ResultadoIndicador),

               sum( IF(MesAnoBSC=$(vMaxMesAno), ResultadoIndicador))

            )

         )

       

      and

      vResult = Aggrif($(vResultReal)>1.5,1.5,$(vResultReal)) * PesoIndicador    , TipoAcumulo, Indicador)

       

       

      Ok, now on the dashboard I have two buttons, and there text are a formula using vResult

       

       

      Button text1 = =Sum({<Objetivo={'Aumentar valor para o acionista'}>}$(vResult))

      Button text2 = =Sum({<Objetivo={'Gerir despesas'}>} $(vResult))

       

      They're only difference is the filter. 

       

      Now, here goes the problem:

      We I click each button, the field Objetivo needs to be selected depending on the clicked button.

      And this make the button not clicked to show "0". The text on the buttons cannot change based on the selected Objetivo.

       

      The QVW is attached, can anyone help please.

       

       

      Rogério Faria

      Brazil

        • SetExpression using variables not ignoring Current Selecion
          Stephen Redmond

          Hi,

           

          You probably should use separate expressions and variables for this.  The problem is that the Set expression also needs to be in the expressions controlled by the variables.  That is why it zeros when you make a selection.

           

           

          Regards,

           

           

          Stephen

            • Re: SetExpression using variables not ignoring Current Selecion

              Thanks for the answer,

               

              But this is the problem.

              I have in this example 2 buttons only, and I will need to create more than 30 buttons (the objectives from our bussiness plan).

               

              So I'd like a way to reuse the expression, changing only the SetExpression.

              I also tried something like that, in hope it would consider the previous SetExpression: ({$<Objetivo=>})

              vResultReal =

                 if(TipoAcumulo='Soma',

                    sum({$<Objetivo=>}RealizadoIndicadores)/sum({$<Objetivo=>}MetaIndicadores),

                    if(TipoAcumulo='Media',

                       avg({$<Objetivo=>}ResultadoIndicador),

                       sum({$<Objetivo=>}IF(MesAnoBSC=$(vMaxMesAno), ResultadoIndicador))

                    )

                 )

               

               

              But it didnt work.

               

              Grateful If any others ideia,

               

              Rogério Faria