Filtering a collection by date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-08-19 12:11 PM
I need to filter a collection using today's date. The collection consists of files, all filenames contain month and year but not date. But the create date (with date and time) is listed in a column in the collection. I know which date I want, but the time can be different from time to time, obviously. .
So I created this expression in the filter of the Filter Collection action in Utility - Collection Manipulation:
StartsWith([Files found.Created]; FormatDate(Today(); "dd.MM.yyyy"))
When I evaluate this expression it works perfectly by giving me False on a file from yesterday and True on a file from today. But when running the collection through a loop it ends up writing both files to the Output collection.
Someone then told me that the filter has a specific syntax, but I can't find any information about it. You'd think there was some sort of guide somewhere but apparently not.
So, any good ideas? I gotta say I thought something as simple as searching for a file based on date could be found in the File Management utility but nope. No such luck.
------------------------------
Johanna Westlund
RPA manager
MAIK AS
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-08-19 02:43 PM
Here are couple of examples to Filter collection which can be found in Process Examples - Collections
"[Product Type]='Vegetable'"
"[Product Name] LIKE 'P%'"
Thank you,
Raj
------------------------------
Rajesh kumar Muthineni
RPA Developer
Highmark Health
America/Chicago
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-08-19 07:26 AM
This works: "[Created]='05.08.2019 13.20.28'" It finds the one row that has this exact date and time in it. But I need it to filter according to the value in a another data item containing today's date.
But if it try "[Created]=[Todays date]" It tells me it can't find the column "Todays date" and if I try "[Created]='[Todays date]'" I get:"ERROR: Internal : Could not execute code stage because exception thrown by code stage: Cannot perform '=' operation on System.DateTime and System.String."
Is there any way around this?
------------------------------
Johanna Westlund
RPA manager
MAIK AS
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-08-19 08:07 AM
"Created >'"&[Data2] &"' and Created<'"&[Data3] &"'"
------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-08-19 02:24 PM
Also Try this one "[Date] LIKE "&"'"&[Today]&"%'". Tested its working
Collection name - COL and Fieldname - Date
------------------------------
Rajesh kumar Muthineni
RPA Developer
Highmark Health
America/Chicago
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-08-19 05:16 PM
Set Date1 to Today's Date
Set Date2 to Tomorrow's Date
Set Date1: FormatDateTime(Today()&" "&LocalTime(),"MM/dd/yyyy")
Set Date2: FormatDateTime(DateAdd("9", "1", Today())&" "&LocalTime(),"MM/dd/yyyy")
Use this in the filter condition
Filer Condition: "[Created] > "&"'" &[Date1]&"' and [Created] < "&"'" &[Date2]&"'"
This filter the files which are created Today. If you want to filter the files with different dates, set Date 1 and Date 2 to those dates.
Hope this helps.
------------------------------
Sandeep Nalla
Senior Consultant
Lateetud Inc
America/New_York
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
14-08-19 01:31 PM
------------------------------
Johanna Westlund
RPA manager
MAIK AS
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
14-08-19 02:03 PM
------------------------------
Sandeep Nalla
Senior Consultant
Lateetud Inc
America/New_York
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
14-08-19 02:04 PM
------------------------------
Johanna Westlund
RPA manager
MAIK AS
------------------------------
