6 Replies Latest reply: May 18, 2016 10:30 PM by purushotham m RSS

    Month Number to Month Name conversion

    Sk Awal

      Hi,

       

      I have a Month field in my Table. And that Field contains values Like this = 'JANUARY', 'FEBRUARY' Like this format. In some of my calculation I am using Maximum Month. So I create a variable vMaxMonth = max(Month).

       

      To Make the Month as Number values I used this piece of code in the script:

      LOAD

      if(capitalize(MONTH) = 'January', 1,

            if(capitalize(MONTH) = 'February', 2,

            if(capitalize(MONTH) = 'March', 3,

          if(capitalize(MONTH) = 'April', 4,

            if(capitalize(MONTH) = 'May', 5,

            if(capitalize(MONTH) = 'June', 6,

            if(capitalize(MONTH) = 'July', 7,

            if(capitalize(MONTH) = 'August', 8,

            if(capitalize(MONTH) = 'September', 9,

           if(capitalize(MONTH) = 'October', 10,

            if(capitalize(MONTH) = 'November', 11, 12))))))))))) as [Month],

       

       

      But when I am showing month in the list box I have to show the Month Like this: Jan, Feb, Mar, Apr Like this.

       

      I was also trying to use the INLINE to Make the Month ordered like this:

      LOAD * INLINE [

          Month

          Jan

          Feb

          Mar

          Apr

          May

          Jun

          Jul

          Aug

          Sep

          Oct

          Nov

          Dec

      ];

       

      But since the Month field is getting number value with the using of IF statement, INLINE month can not match with that.

       

      Can anybody guide me how can i achieve above mentioned functionality from the script?

       

      Thanks,

      Sk