4 Replies Latest reply: May 15, 2014 10:13 AM by KeyserSoze _ RSS

    DateIsInRange

    Oli _

      Hi,

      I've got a problem with DateIsInRange.

       

      I've got a model with:

      starting period in field 1 (e.g. 01.03.2012)

      ending period in field 2 (e.g. 31.05.2012)

      an date field 3 (e.g. 15.04.2012)

       

      I like to idetify all the lines which are true with the field date in field 3 (all lines which are in the periode 01.03-31.05.2012)

        • DateIsInRange
          kbelli _

          I hope I'm understanding correctly.  Are fields 1, 2, and 3 all defined as dates?  Because I would think you could just do this:

           

          Indicator Field

           

          if( >= .and. <= , 1, 0 )

           

           

          or this:

           

          Filter

           

          >= .and. <=

          • DateIsInRange
            Olly Bond

            Hello Olli

             

            You can compare dates with simple operators, like "greater than or equal to". I'm writing this from a Blackberry so can't actually write the symbols Aha - found the "sym" button.

             

            Field3 >= Field1 .and. Field3 <= Field2

             

            Should work.

             

            Mfg

             

            Olly

              • DateIsInRange
                Oli _

                ...thanks, this should work. But what is with the usage of the function "DateIsInRange" ? Can this work, too ?

                I tried it but I always get "Nill"

                  • DateIsInRange
                    KeyserSoze _

                    DateIsInRange(RptDate,StartDate,EndDate)

                     

                    So long as EndDate > StartDate, DateIsInRange essentially uses

                     

                    If((RptDate >= StartDate) .And. (RptDate < EndDate),1,0)

                     

                    Note that if RptDate = EndDate then DateIsInRange will return 0.

                     

                    If you're getting null values then at least one of the dates that you're using in DateIsInRange isn't a valid date value to Monarch.