pf date range

 7 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
ryand
Veteran Member
Posts: 51
Veteran Member
    Is there a way to run a pf query for a date range instead of just for one day? Example: querying for all employees who transferred in the last 7 days.
    Sam Simpson
    Veteran Member
    Posts: 239
    Veteran Member
      Check your Pflow.js file. There's a javascript function to add days, month and years. Last 7 days means you have to add negative 7 to today's date.
      ryand
      Veteran Member
      Posts: 51
      Veteran Member
        Do you mean this: getDateDME(AddDay(today(),-7)) ? That does not give me each day but 7 days from now....i'm going for every day in one query. Just me adding the date stamp 7 times in the Select Criteria is not working.
        David Williams
        Veteran Member
        Posts: 1127
        Veteran Member
          You need to make your select statement something like EFFECTIVE-DATE <= queryDate
          David Williams
          Sam Simpson
          Veteran Member
          Posts: 239
          Veteran Member
            You are almost there. Your first variable is like your function...ex..

            VAR1=getDateDME(AddDay(today(),-7))
            Var2=getDateDME(today())

            Then somewhere in your flow you test your dates if >= VAR1 and <= VAR2.

            John Henley
            Posts: 3353
              You have to use javascript/function to calculate a mindate and max date; then use >=mindate and <=maxdate.

              I have an example for sending "new hires in the past week", "terms in the past week", etc. I will try to post the logic. =
              Thanks for using the LawsonGuru.com forums!
              John
              ryand
              Veteran Member
              Posts: 51
              Veteran Member
                Ok I got it to work using the <= and >= plus the date retrievals. Thanks for the help as always Sam and David.
                Sam Simpson
                Veteran Member
                Posts: 239
                Veteran Member
                  This is just a reminder when testing for dates that is coming from the database. Depending on your database, testing of dates should be in the same format. If your database dates are in DME then test them using the DME formatting, AGS dates should be tested against AGS format or JS dates against js dates. You need to be consistent on what type of dates you are testing, otherwise, you will find a lot of errors.