2 Replies Latest reply on Jul 4, 2014 12:52 PM by AnthonyJeffries

    Simple? Adding days to time for portal search problem.

    AnthonyJeffries

      Title

      Simple? Adding days to time for portal search problem.

      Post

           I have a problem that I can't figure out. Any help would be much appreciated.

           The script below is supposed to give me a list of records (without the lower limit for simplicity) of people who have been hired for up to 90 days. The problem is that I can't seem to add days to time properly. Int ( time ) is just the last function I tried to use before asking for help. I have used all of the other time and date functions in many different ways, but none of them seem to work properly.

            

           This is in a portal filter calculation. So, someone please show me the error in my ways. :)

            

           (Get ( CurrentDate ) - Int ( 90 )) ≤ (Staff::Hire Date + Int ( 90 ))

        • 1. Re: Simple? Adding days to time for portal search problem.
          philmodjunk

               is Hire Date a date field, a text field or a TimeStamp field?

               Assuming that it is a date field, this expression should work :

               (Get ( CurrentDate ) - 90 ) < Staff::Hire Date

               But the context in which you use this expression and the implementation details can make a difference. Is this a portal filter? A variation of this could be used as find criteria and a different version could even be a match field in a relationship if the terms to the left of the inequality are encoded correctly into an unstored calculation field.

               For a timestamp field, you'd need to subtract the equivalent number of seconds, 7776000 seconds = 90 days.

          • 2. Re: Simple? Adding days to time for portal search problem.
            AnthonyJeffries

                 Ok thanks, this one worked perfectly. It finds records only in the 90 day period from hire to day 90. 

                  

                 (Get ( CurrentDate ) - 90 ) ≤ (Staff::Hire Date + 90 ) and (Get ( CurrentDate ) - 90 ) ≤ (Staff::Hire Date) and IsEmpty ( Staff::Termination Date )

                  

                 By the way, awesome response time Phil! :-D

                 Tony