9 Replies Latest reply: May 15, 2014 10:04 AM by Olly Bond RSS

    Month query

    KarenG _

      Hi

       

      I am trying to split out the month out of a date , for instance

       

      01/05/09 - instead of returning "5".. i want to be able to return "MAY"...

       

      how can i do this?

       

      Karen

        • Month query
          fino _

          hi,

          try

          Create a calculated character field called Month

          MonthName_Eng(Date)

          • Month query
            Grant Perkins

            Hi Karen,

             

            There are a couple of ways to approach this  - the choice is yours ...!

             

            You could create a Lookup Table that lists the month number in one column and the name in the next.

             

            To get the Month Name into you data table then becomes a simple lookup based on identifying the month number with Month(yourdate).

             

            If you have noy user INTERNAL LOOKUPs before read through the Help section which provides a comprehensive reference to the whole subject. It's not difficult but does have a few options for different requirements (more complex than your is here) so reading it is a good idea.

             

            The alternative is to use a calculated field and a formula, also based on the Month() function.

             

            If(Month(yourdate)=1, "Jan","")+

            If(Month(yourdate)=2,"Feb","")+

            If(Month(yourdate)=3,"Mar","")+

            ...

            If(Month(yourdate)=12,"Dec","")

             

             

            and so on for the 12 months.

             

            There are other ways but these are the most logical approaches since the Month() function is kindly provided.

             

            If you now have V9 or V10 you could make the Lookup approach an Object that can be imported or shared (either) for all lyou models that reuire the 'translation' and so the Lookup Table or formula only need be created once.

             

            You can re-use the originals in earlier versions of Monarch of course by copying from one model to another - but not quite so easily!

             

            HTH.

             

             

            Grant

            • Month query
              KarenG _

              just to let you know - went with the lookup table.. easiest way around it... thanks guys