6 Replies Latest reply: May 27, 2011 12:48 PM by Nicolai Jørgensen RSS

    Order by

      Hello everyone,

       

      I need a litle help here, hope that its possible:

       

      I'm trying to map months with then respectives codes, somethink like that:

       

       

      Map1:

      Mapping Load*Inline [cod_month, month

                                         1, Jan

                                          ....

                                          12, Dec]

       

      Then i'm doing the apply map into other load:

       

      Load a, b, c, apply map('Map1', c_month ) as month, e, f, g from .....;

       

      Now i would like to order the months from january to december.

       

      I tried the order by function with the resident of Map1 but its not really working.

       

      Any suggestions?

       

      Best regards,

      Eliano Marques

        • Order by
          Kaushik Solanki

          Hi,

           

               You can do one thing while loding data you can give an expression as

                if(Month = 'Jan',1,

                  if(Month = 'Feb',2,............ )))) as month_Order

           

               Hope this will help you

           

          Regards,

          Kaushik Solanki

          • Order by
            Nicolai Jørgensen

            Hi, I assume your c_months are 1, 2, 3, 4 since your mapping is ordered that way? If yes, why not have both the c_month value (1, 2...) and the mapped month name in the record. You can then easily sort it that way, e.g.:

                 Load  a, b, c, c_month, ApplyMap('Map1', c_month) as month

                 from [somewhere]