2 Replies Latest reply: Jan 12, 2012 11:22 AM by Deepak Vadithala RSS

    *** Select field values based on variables ***

    Deepak Vadithala

      Dear All,

       

      I have a quick question. Hope someone can answer this for me...

       

      I have two variable vMin & vMax. These two variables hold the values by using the slider object. Now I wanted to filter data in ListBox/Fieldbased on these two variables.

       

      Here is the expression where I have used variables.

       

      =IF(Aggr(Count(DISTINCT MyMatch), My_ID)>= $(vMin) AND Aggr(Count(DISTINCT MyMatch), c_My) <= $(vMax), MyFieldName)

       

      If I use the above expression to generate MyFieldName ListBox,it works fine. However, I need to show the statistics (Count) of each item in MyFieldName. So I am assuming that I can't generate my MyFieldName by using the expression because I can't show the statistics.

       

      So I thought I would use “Select in field” action on variable change event. I mean when user changes the variables then relevant selection should be applied on MyFieldName ListBox.

       

      I hope this makes sense.

       

      Thanks in advance.

       

      Cheers - DV

        • Re: *** Select field values based on variables ***
          Miguel Angel Baeyens de Arce

          Hi DV,

           

          Use another Match() to return actual field values instead of aggregated values:

           

          If(
               Match(MyFieldName, 
               $(=
               Chr(39) & 
               Concat(DISTINCT IF(Aggr(Count(DISTINCT MyMatch), My_ID)>= $(vMin) AND Aggr(Count(DISTINCT MyMatch),c_My) <= $(vMax), MyFieldName), Chr(39) & Chr(44) & Chr(39))
                & Chr(39)
               )
               ), MyFieldName)
          

           

          Check parentheses because I have not tested it and I may have missed some of them. The idea is that now you are showing not the result of an aggregation but, based on that aggregation, actual field values. The expression is quite complex, so it may take longer than expected to render.

           

          Hope that helps.

           

          Miguel

            • Re: *** Select field values based on variables ***
              Deepak Vadithala

              Hi Miguel,

               

              Thank you very much for quick response. I'll test this one and logically it makes sense. Just thinking ahead on performance issues. Is there a better approach to solve this issue. I think the best idea is to derive the slider values from field instead of dynamic variables. Because when I use the variables within expression then my selections are not at Document level rather object level. However, if I have the field in sliders then all the filters are applied at document level.

               

              I'm not sure if there is a simple workaround to solve this issue. Any suggestions on this is really appreciated.

               

              Thanks again for your help & time.

               

              Cheers - DV