Skip to main content

Quarter 1 is April, May and June; Q2 = July, Aug, Sept; Q3 = Oct, Nov, Dec; and Q4 as Jan, Feb, March.

If I need to run a workbench at regular intervals throughout the year, which transformers will I need to identify features from the current month, and current quarter?

I have converted the dates to FME format, and I guess I need to add a DateTimeStamper to get the current date. Then what do I need to do?

Many thanks in advance for any pointers you can give me.

Regards

Stu

A DateTimeStamper will give you a number that represents the current date, but you can also use string functions to pick characters out of it. In an AttributeCreator, create Month = @Substring(@Value(_timestamp),4,2)

And from that create a Quarter attribute with a conditional statement, if Month In 04,05,06, then Quarter 1, if Month in 07,08,09 then Quarter 2 etc.


You can also calculate the quarter from the month, for example with something like this:

@fmod(@ceil(@Value(Month)/3)+2,4)+1

Be careful you do not inadvertently process months or quarters of a wrong year. Maybe add the year to month and quarter, e.g. 2023-Q3.


Reply