7 Replies Latest reply: May 13, 2011 3:20 AM by ASchempp RSS

    Conditional show of chart based on 2 conditions

      Hi all,

       

      I am trying to implement a "conditional show" for charts based on two conditions and I want to achieve the following:

      If the CurrencyType = 'Reporting Currency' and if Country = Blank, then hide the chart.

       

      I am using the following expression - but it is obviously not the correct one:

       

      if((getfieldselections(CurrencyType='Reporting Currency' and getselectedcount(country)=0),0)

       

       

      Does anyone know what I is the wrong bit in the expression?

       

      Thanks!

      Adi

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

        • Re: Conditional show of chart based on 2 conditions
          Toni Kautto

          There are a couple things that do not add up properly in your expression.

           

          First of all the Conditional Show expression should be logical, so that it results in True or False. This means that you do not use a IF statement, instead you only use the IF statements condition part as your Conditional Show expression.

           

           

          As you can see below the GetFieldSelections() inparams in your expression are not valid. The function will return a string, from which you should look for the FieldSelection in.

           

          String GetFieldSelections( fieldname [, valuesep [, maxvalues=6 ]] )

           

           

          My suggestion is that you first get the currently selected values

           

          GetFieldSelections(CurrencyType, ';')

           

           

          then you look for your preferred selection within the selected values

           

          SubStringCount( GetFieldSelections(CurrencyType, ';'), 'Reporting Currency' )

           

           

          By applying this to your requirements you should end up with a expression looking somewhat like;

           

          SubStringCount( GetFieldSelections(CurrencyType, ';'), 'Reporting Currency' ) = 1 AND GetSelectedCount(country)=0

            • Conditional show of chart based on 2 conditions

              Hi Toni,

               

              thanks for your help on this!

              I still have a doubt though as only one part of what I expect is working. 

               

              Using

              SubStringCount( GetFieldSelections(CurrencyType, ';'), 'Reporting Currency' ) = 0 AND GetSelectedCount(country)=1

              gives me the desired result for all cases, where no country is selected:

              1. If Reporting Currency selected, table not shown

              2. If Group Currenc selected, table shown.

               

              However when I select a country, the table does not appear at all, independant of the currency selected, but infact, both currency types are valid if looking at one country only....

               

              I was playing around with the expression, but I couln't figure out the proper one.

              Thanks again for your help!

                • Re: Conditional show of chart based on 2 conditions
                  Toni Kautto

                  Please attach a sample of your QVW file to make evaluation of your problem a bit easier.

                   

                  If the file contains sensitive data please use the Scrambling function to make it unreadable;

                  Settings > Document Settings > Scrambling

                    • Re: Conditional show of chart based on 2 conditions
                      Toni Kautto

                      Ah, now I see that you have written Country = Blank in the initial description. Could you clarify if this means that you have a blank row in your list or if it means that no selections are made in the list?

                       

                      GetSelectedCount(country)=1 will be true if the case is that you have a selection in your list that corrsponds to blank, meaning that one item actually is selected in the list.

                       

                      Still it would make it easier to evaluate if you could provide a sample app as I do not really follow in detail on your setup with lists and chart objects.

                        • Re: Conditional show of chart based on 2 conditions

                          Hi again,

                           

                          I am attaching you a file, that helpt to understand the issue.

                          When I mean country = blank, I am refering to no selection made for country.....

                           

                          I have a table, where I would like to show some financial indicators per country - as long as all countries are shown (=no country selected), the table only makes sense in Group Currency, not in Reporting (or country specific) currency. But once one country is selected, both Reporting and Group Currency are valid results....

                           

                          Thanks a lot for your help!

                            • Re: Conditional show of chart based on 2 conditions
                              Toni Kautto

                              First of all you have missplaced the expression, it should be added as the Conditional Show and not as Calculation Condition.

                               

                              Chart Properties > Layout > Show Conditional

                               

                               

                              A slight correction of my previous suggestion, if you want the user to select a country and a Currency Type except 'Reporting Currency';

                               

                              SubStringCount( GetFieldSelections([Currency Type], ';'), 'Reporting Currency') = 0 AND GetSelectedCount(Country)>0

                               

                              If you instead have Country as andatory and Currenc Type as optional;

                               

                              (GetSelectedCount([Currency Type])=0 OR SubStringCount( GetFieldSelections([Currency Type], ';'), 'Reporting Currency' ) = 0) AND GetSelectedCount(Country)>0

                               

                               

                              See attached QVW for my example.