Skip to main content
Solved

How to use StringSearcher to find today's date in a list

  • March 13, 2023
  • 1 reply
  • 43 views

Forum|alt.badge.img

Hello, i have a list of files from an FTP server that I have read into a List. The last field in the list is the file name. The file name generally follows this format: "ProjectInfo_YYYYMMDD". YYYY is the four digit year, MM is the 2 digit month, and DD is the 2 digit day. I want to choose the one that matches today's date. I'm guessing this can be accomplished with the use of a user param or regular expression but I can't seem to find a reference on it. Any assistance would be appreciated.

Best answer by dustin

One way to accomplish with a single Tester or TestFilter:

Set the left value to:

@Substring(@Value(file_name),-8,8)

Set the right value to 

@DateTimeFormat(@DateTimeNow(),%Y%m%d)

image

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • 629 replies
  • Best Answer
  • March 13, 2023

One way to accomplish with a single Tester or TestFilter:

Set the left value to:

@Substring(@Value(file_name),-8,8)

Set the right value to 

@DateTimeFormat(@DateTimeNow(),%Y%m%d)

image