Skip to main content
Solved

Can I parse the year from a Date field using a tester?

  • April 7, 2022
  • 2 replies
  • 112 views

Forum|alt.badge.img+2

I have a date being read in from a SDE geodatabase. It is in M/D/YYYY. I have the user input a year. I want to test it against the year in the table and only select the years that match. Is it possible to parse out the year in the tester or do I have to add in a DateTimeConverter Transformer to change the format?

Best answer by andreaatsafe

Hi @chris28​ ,

 

You should be able to use a Tester with the "contains" operator. You would have the SDE date as the left value and the attribute holding the user's input year as the right value.

I'm not sure how you have set up the user input year, if the user's input year is from a parameter and isn't tied to an attribute already in the workflow, you'll need to use the ParameterFetcher to put it into an attribute, then you can use the Tester.

 

Here's a sample workflow that I set up using Excel, but the idea of using the ParameterFetcher to the Tester should work for you as well:

DateTester 

-Andrea

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.

2 replies

andreaatsafe
Safer
Forum|alt.badge.img+14
  • Safer
  • 445 replies
  • Best Answer
  • April 7, 2022

Hi @chris28​ ,

 

You should be able to use a Tester with the "contains" operator. You would have the SDE date as the left value and the attribute holding the user's input year as the right value.

I'm not sure how you have set up the user input year, if the user's input year is from a parameter and isn't tied to an attribute already in the workflow, you'll need to use the ParameterFetcher to put it into an attribute, then you can use the Tester.

 

Here's a sample workflow that I set up using Excel, but the idea of using the ParameterFetcher to the Tester should work for you as well:

DateTester 

-Andrea


Forum|alt.badge.img+2
  • Author
  • 32 replies
  • April 7, 2022

Thanks Andrea! That did exactly what I wanted!!