If I have a date field formatted as month-day-year is there a way to retreive just the month and use it in a tester? I want the user to input a month and then if it matches the month in the date field it will select all of those records. The data is in a geodatabase if that matters.
You can use the AttributeSplitter to split the date field on "-". The first element in the list, _list{0}, will be the month.
Or maybe something like
@DateTimeFormat(@DateTimeParse(@Value(YourDateString),%N-%d-%Y),%N)
Or even with a StringSearcher, with the Regular Expression
^>^-]
(Get all characters from the start of the string, up to the first dash)
You can use the AttributeSplitter to split the date field on "-". The first element in the list, _list{0}, will be the month.
You must have deleted your first suggestion which was to use @DateTimeFormat(@Value(date), %m) to extract the month. I used that and it worked perfectly! Thanks! I never tried your other suggestions as this one did the job!
You must have deleted your first suggestion which was to use @DateTimeFormat(@Value(date), %m) to extract the month. I used that and it worked perfectly! Thanks! I never tried your other suggestions as this one did the job!
Ha! I initially answered without testing. When I was testing, it wasn't acting as I thought so I deleted it. But never-the-less, glad it worked for you 😁
If reading from a geodatabase, you could use a where clause in a feature reader, and set the numbered month with a user parameter so only those records are read which match the month selected
e.g.
EXTRACT(MONTH FROM "datefield") =$(month)