Created on 11-19-2020 10:58 AM - edited 11-19-2020 11:09 AM
Hi everyone,
I want to use a RouteOnAttribute to only pick up files with the current date. What expression can I use to achieve this?
The files in the SFTP I am fetching from are suffixed with a date as follows:
_2020_11_04_06_37
_YYYY_MM_DD_HH_MM
Thanks!
Created on 11-20-2020 07:32 AM - edited 11-20-2020 07:33 AM
@Makaveli The solution you are looking for here is updateAttribute to create your string of the date format you want. todayString =
{now():format('YYYY_MM_dd_mm')}
Then in routeOnText you use this attribute like this: newRoute =
${filename:endsWith(_${todayString}}
If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.
Thanks,
Steven
Created 11-20-2020 10:11 AM
@stevenmatison thanks for the reply. So you're saying from my LISTSFTP processor I should connect a UpdateAttribute processor with the expression you mentioned, then have a RouteText processor connected to the UpdateAttribute processor?
I tried the above and the UpdateAttribute is picking up all files in the SFTP regardless of the date today, any recommendations?
Thanks
Created 11-23-2020 05:21 AM
@Makaveli You can use File Filter Regex in ListSFTP to control which files come out of this processor. Otherwise, you need to use ListSftp->UpdateAttribute->RouteOnAttribute to make sure the file name ends as suggested above. Once you have a solid route of the files you want, then connect to FetchSFTP.