Solved

Test Filter Date Calculation

  • 7 May 2019
  • 1 reply
  • 24 views

When using Test filter, how do I capture todays date -65?

SQL Statement would read "Field_1" >=(GetDate()-65)

icon

Best answer by chrisatsafe 7 May 2019, 23:51

View original

1 reply

Badge +2

Hi @sigmadon_max,

If you want to use a Date/Time Function for the right value of the Tester, you will want to set the right value to something like:

@DateTimeAdd(@DateTimeFormat(@DateTimeNow(),%Y%m%d),-P65D)

Note: you will want the dates to be formatted the same so you may not necessarily use %Y%m%d.

The Date/Time Functions documentation will be an excellent resource to learn more about formatting, etc.

Alternatively, you can use something like the DateTimeStamper to create a new attribute for today's date, followed by a DateTimeCalculator to subtract 65 days (and a DateTimeConverter to format it accordingly). Then, simply set the right value of the Tester to the newly created date attribute - you can remove this attribute after testing.

Hope this helps!

Reply