Setfilter with only end date

Item.SETFILTER(“Date Filter”,’%1…%2’,“Should be less than start date”,StartDate);

I need to set a date filter with no start date and only end date.

i.e: all the records before start date.

i.e: (where date < ‘2017-02-05’)

Please Help.

Hello,

a simple IF condition should do it.

IF StartDate = 0D THEN Item.SETFILTER(“Date Filter”,’…%2’,EndingDate) else Item.SETFILTER(“Date Filter”,’%1…%2’,StartingDate,EndingDate)

best regards,

Thank you for your quick reply…!!!

No problem!

I’ve made some mistake in the above code.

IF StartDate = 0D THEN Item.SETFILTER(“Date Filter”,’…%2’,EndingDate) else Item.SETFILTER(“Date Filter”,’%1…%2’,StartingDate,EndingDate)

The bolded part should have been %1, but i think you have found this out yourself.

Corect code:

IF StartDate = 0D THEN Item.SETFILTER(“Date Filter”,’…%1’,EndingDate) else Item.SETFILTER(“Date Filter”,’%1…%2’,StartingDate,EndingDate)

best regards,