2 Replies Latest reply: May 16, 2011 8:23 AM by Dennis Hoogenboom RSS

    Variables issue (in stead of IF(..).. )

    Dennis Hoogenboom

      Dear specialists,

      I am trying to use a variable to determine which data I have to use in my expression.
      See the attached document for an example.

      In this example I got on the right side the outcome how I want it to be.
      But there I am using a large IF(..)-function like:

       

      IF (Keuzelijst1.Keuzelijst1 = 'Been', (Sum(Been)),
      IF (Keuzelijst1.Keuzelijst1 = 'BMI', (Sum(BMI)),
      IF (Keuzelijst1.Keuzelijst1 = 'Buik', (Sum(Buik)),
      IF (Keuzelijst1.Keuzelijst1 = 'Calorieën', (Sum(CalWeek)),
      IF (Keuzelijst1.Keuzelijst1 = 'Heup', (Sum(Heup)),
      IF (Keuzelijst1.Keuzelijst1 = 'Gewicht', (Sum(Gewicht)),
      IF (Keuzelijst1.Keuzelijst1 = 'Vet%', (Sum(Vet%)))))))))
      
      

       

       

      I want to get rite of this because it isn't flexible at all.
      To accomplish this I made 2 inline tables with the names of the fields I want to use in my expression. And 2 variables that display the selected field.

      What I want is to use the result as this:

      SUM('variable')   (in my case SUM(vKeuze1) or SUM('vKeuze1'))

      Is this possible?
      And if so, how?

       

      Thanks.