7 Replies Latest reply: Mar 6, 2012 9:00 PM by ssha 324 RSS

    why doesn't this work?

      if(Created_On=>'01.04.2010' or Created_On<='31.03.2011','10/11',

      if(Created_On=>'01.04.2011' or Created_On<='31.03.2012','11/12')) as COD

       

        • why doesn't this work?
          Ashok Chandran

          Hi

           

               May be the date  format is mismatched.

           

               You will try using the num() function before your operands.

           

          i.e

           

          example

           

               num(created_On) => num(01.04.2010)  ....

           

          Regards

           

          Ashok

          • why doesn't this work?
            jagan mohan rao appala

            Hi,

             

            You have to use '>=' instead of '=>', and one more thing both the date formats should be same.

             

            if(Created_On >= '01.04.2010' or Created_On <= '31.03.2011','10/11',

            if(Created_On >= '01.04.2011' or Created_On <= '31.03.2012','11/12')) as COD

             

            Hope this helps you.

             

            Regards,

            Jagan.

            • why doesn't this work?
              Celambarasan Adhimulam

              Hi,

               

              Try with this

                  

              if(Created_On>= Date(Date#('01.04.2010')) and Created_On<=Date(Date#('31.03.2011')),'10/11',

              if(Created_On>=Date(Date#('01.04.2011')) and Created_On<=Date(Date#('31.03.2012')),'11/12')) as COD

               

              Hope it helps

              Celambarasan

              • why doesn't this work?
                Rahul Gupta

                Hey Hi,

                 

                Use this

                 

                if(Date(Created_On,'DD.MM.YYYY') =>'01.04.2010' or  Date(Created_On,'DD.MM.YYYY') <='31.03.2011','10/11',

                if(Date(Created_On,'DD.MM.YYYY')=>'01.04.2011' or  Date(Created_On,'DD.MM.YYYY')<='31.03.2012','11/12')) as COD

                 

                Regards

                 

                Rahul Gupta

                • why doesn't this work?
                  Dave Riley

                  If you want a more dynamic option, I use something like this which means you don't have to keep going back to add/change the date test values, it just uses the actual year in the date ...

                   

                  YrMap:
                  MAPPING LOAD * INLINE [
                      Month, Adjust
                      1,-1
                      2,-1
                      3,-1];

                   

                  Data:
                  LOAD * INLINE [
                      Date
                      01/01/2010
                      23/02/2011
                      03/06/2010
                      01/04/2011
                      31/03/2011
                  ];

                   

                  FiscalData:
                  LOAD
                  Date as FiscalDate,
                  Right(Year(Date) + ApplyMap('YrMap',Month(Date),0),2)
                    & '/' & Right(Year(Date) + ApplyMap('YrMap',Month(Date),0)+1,2) as FiscalYr
                  RESIDENT Data;

                   

                   

                  flipside