6 Replies Latest reply: Jan 29, 2014 4:15 PM by Greg Anderson RSS

    Any wrong with my code in alternate state?

    ben lim

      I am using alternate state namely : Group 1 and Group 2. Am i able to use set analysis on values that is group under 1 and 2?

       

      I am creating a valuelist Barchart to have the customized X axis

       

      Dimension of bar chart

       

      =ValueList('LADEN','EMPTY')

      Expression of bar chart

       

      A=

      if(ValueList('LADEN','EMPTY') = 'LADEN',
      sum({[Group 1]<Derived_Container_Class_Name={'LADEN'}>}TEU),
      if(ValueList('LADEN','EMPTY') = 'EMPTY',
      sum({[Group 1]<Derived_Container_Class_Name={'EMPTY'}>}TEU)))

       

      B=

      if(ValueList('LADEN','EMPTY') = 'LADEN',
      sum({[Group 2]<Transit_Container_Class={'F'}>}Transit_TEU),
      if(ValueList('LADEN','EMPTY') = 'EMPTY',
      sum({[Group 2]<Transit_Container_Class={'E'}>}Transit_TEU)))

       

      it seems that the value does  not change, any wrrong with my code, thanks

        • Re: Any wrong with my code in alternate state?
          sujeet singh

          Ben can you provide the sample

          • Re: Any wrong with my code in alternate state?
            Sokkorn Cheav

            Hi Bennn,

             

            Your expression look ok. Which list box use alternate state? Or possible attached your file here?

             

            Regards,

            Sokkorn

              • Re: Any wrong with my code in alternate state?
                ben lim

                I really hope I can give the sample file... I guess I might have to recreate with dummy data. Ok If I can give screenshot?
                My code

                 

                 

                =

                if(ValueList('LADEN','EMPTY') = 'LADEN',
                sum({[Group 1]<Derived_Container_Class_Name={'LADEN'}>}TEU),
                if(ValueList('LADEN','EMPTY') = 'EMPTY',

                 

                as you can see from the selection and table name A, i seleted Throughput A EMPTY but it shows data for Laden and Empty. The data seems fix no matter what selection i choose on the selection box. Figures shown on the graph are all wrong....


                sum({[Group 1]<Derived_Container_Class_Name={'EMPTY'}>}TEU)))

              • Re: Any wrong with my code in alternate state?
                Jonathan Dienst

                Hi

                 

                The alternate states refer to selections made in that state, such as in a list box set to that state. I am not sure what you are trying to achieve with this expression, but I think the states are superfluous and possibly breaking your logic. Try the expressions without states.

                 

                Have you applied states to the tab containing this chart or to the chart object itself?

                 

                HTH

                Jonathan

                  • Re: Any wrong with my code in alternate state?
                    ben lim

                    I agree. I have tried to select other fields and it seems that it is working. it seems that there is a conflict when I choose Container Status on panel box when my code is already defined for this. so sorry about it, haha. IT SEEMS WORKING!!! haha thanks everyone

                      • Re: Any wrong with my code in alternate state?
                        ben lim

                        I have decided not to use Valuelist as it might be difficult to maintain,

                        Instead I have put it on the dimension in this way

                         

                         

                        =

                        if(Derived_Container_Class_Name='LADEN' or Transit_Container_Class = 'F','LADEN'
                        ,
                        if(Derived_Container_Class_Name = 'EMPTY' or Transit_Container_Class='E','EMPTY')
                        )

                         

                         

                        However, I have Database A that has Country and Database B that has Transit_Country.

                         

                        Instead of listing out all the country saying if(Country = Indonesia or Transit_Country - Indonesia','Indonesia',)is there any shortcut ways that they will do matching by themself and call the specific name?

                         

                        this will help greatly

                    • Re: Any wrong with my code in alternate state?
                      Greg Anderson

                      While your script looks okay per se, it does appear that you could simplify some of these comparisons by doing the data manipulation in the load script and assigning variables to some of the items that are being used for comparison.