4 Replies Latest reply: Oct 12, 2012 3:28 PM by John Witherspoon RSS

    How do I script this?

      I have a calendar conrol in my script and a list box in my application showing the Quarter.  The values in the list box are 1,2,3, & 4.  For a calculated dimension, I want to show some data based on the selection of the quarter in the list box.  For example, if the quarter selected = 3, then show X, if the quarter = 4 then show Y, etc.


        • Re: How do I script this?
          Rebecca Molstad

          You can do this with conditional calculations or conditional layouts, depending on what you want your end result to look like. Do you have a sample file of what you are looking to achieve?

            • Re: How do I script this?

              The field for calendar quater in the list box is CAL_QTR, in the calculated dimesion of the chart I am looking for something like,


              If the CAL_QTR selected inthe list box =3, then 'SEP', if the CAL_QTR selected = 1, 'MAR',


              I am just not sure of the script when trying to reference selections made in the list boxes.



                • Re: How do I script this?
                  Rebecca Molstad

                  You could use something like this in the conditional layout:


                  =SubStringCount(Concat(CAL_QTR, '|'), '1') 

                  • Re: How do I script this?
                    John Witherspoon

                    I'm not a fan of calculated dimensions and I wouldn't reference the selections from the list box.  I'd build it as data.  I assume you have a calendar table with the CAL_QTR field in it.  I would add something like CAL_QTR_MONTH with the values you want.  Something like this, say:


                    pick(CAL_QTR,'MAR','JUN','SEP','DEC') as CAL_QTR_MONTH,


                    For performance, it's generally better to do this sort of thing in script than in charts.  From a maintenance standpoint, then it's in one place instead of potentially in multiple charts.  And as a general rule, I'd rather put complexity in my script than in my charts, even if it's the same level of complexity and there's no duplication.  I have a hard time putting my finger on why, though, other than the previous two reasons.