Suppose there are some features in different state, I want those features to be written like that: ABC_STATENAME_DATETIME.xls.,, so that all the features for a particular state are written in a separate file with datetime and all features in other state are written in other file like that. I tried using attributevalue and datetimeformat in feature writer but it was taking too much time because datetime was being calculated for million for features that were coming in. I just want it to be a 1 file with a final timestamp, not multiple. Any easy/fast way?
Page 1 / 1
One way to do this is to create a (Python) scripted parameter, something like:
import datetime
datetime.datetime.now()
And use that in the fanout. All the data will get the datetime from the start of the run.
One way to do this is to create a (Python) scripted parameter, something like:
import datetime
datetime.datetime.now()
And use that in the fanout. All the data will get the datetime from the start of the run.
I agree about the solution (I use it myself quite often), but you'll have to format the output from now() to get a string that FME will accept as a return value. Example:
import datetime
n = datetime.datetime.now()
return n.strftime('%Y%m%d') # Example: '20210921'
Incidentally, the formatting codes used by strftime() are identical to the DateTimeConverter, so it's easy to adapt to whatever you need.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.