I'm trying to filter records for the last three years of data but want to avoid having to edit the transformer on a yearly basis (ie. TestFilter: Year= 2021, Year= 2020, Year = 2019 - necessitating a yearly update at the change of the year). I'm hoping to find a way to set up an attribute filter or test filter that can be set on the relative time frame (ie. Year = this year, Year = last year, Year = two years ago). I'm guessing there is a simple way to do this with the text editor but I haven't been able to figure it out!
Page 1 / 1
Hi @kcarlsonham ,
Good question, you can get this done with a TestFilter using the DateTimeFunctions in the Text Editor. Try using the following:
@DateTimeFormat(@DateTimeAdd(@DateTimeNow(),-P1Y),%Y)
-P1Y for the previous year and -P2Y for 2 years ago.
Hi @kcarlsonham ,
Good question, you can get this done with a TestFilter using the DateTimeFunctions in the Text Editor. Try using the following:
@DateTimeFormat(@DateTimeAdd(@DateTimeNow(),-P1Y),%Y)
-P1Y for the previous year and -P2Y for 2 years ago.
I should note... this is also possible by creating a new date attribute (DateTimeStamper > DateTimeCalculator (subtract 1 and 2 years) > DateTimeConverter) if you want to set it up using transformers instead. Depends on your preference
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.