Search code examples
filtercollectionsfilteringblueprism

Is there a way to filter a folder by dates Blue Prism


I am having issues around [Utility - Collection Manipulation - Filter Collection] I have a Get Files action which gets all the files from a particular folder and outputs them into a collection in Blue Prism (there are 14 .txt files) I then use the Filter Collection Object to filter this folder "Files" I am trying to only bring back results in the collection for where the "Created" (DateTime) = today or yesterdays date.

Date1( DateTime) FormatDateTime(Today()&" "&LocalTime(),"dd/MM/yyyy") Date2(DateTime) FormatDateTime(DateAdd("9", "-2", Today())&" "&LocalTime(),"dd/MM/yyyy")

Filter Expression : "[Created] <= "&"'" &[Date1]&"' and [Created] >= "&"'" &[Date2]&"'"

There is no Error message and it doesn't output any results. I am thinking that maybe Date1 and Date2 aren't being read as dates perhaps?

Any help on this matter would be greatly appreciated.

Regards,

Gary


Solution

  • Part of the problem may be: This: FormatDateTime(Today()&" "&LocalTime(),"dd/MM/yyyy") Delivers this: 30/11/2020 ==> Note there's no time!

    This: FormatDateTime(Today(),"dd/MM/yyyy") &" "&LocalTime() Delivers this: 30/11/2020 11:45 ==> Time included! Which might be what you're looking for. This: FormatDateTime(Today()&" "&LocalTime(),"dd/MM/yyyy hh:mm") does the same.