Skip to main content
Question

@DateTimeFormat in FeatureWriter with multiple sheets

  • December 15, 2023
  • 3 replies
  • 39 views

galigis
Enthusiast
Forum|alt.badge.img+20

Hi All,

 

How can I force FME to write a single excel file with an unique DateTime value for all the Excel sheets included in a FeatureWriter? see the details below:

image 

Atm FeatureWriter writes a 'datetime' per excel sheet therefore export multiple xlsx instead of one single excel file.

 

Any ideas? 🙂

 

 

 

 

3 replies

nielsgerrits
VIP
Forum|alt.badge.img+61

When I need this, I create a Scripted Parameter. (Navigator, User Parameters)

This works:

import datetime
 
timestamp = datetime.datetime.now().strftime("%H_%M_%S")
return timestamp

 


galigis
Enthusiast
Forum|alt.badge.img+20
  • Author
  • Enthusiast
  • December 15, 2023

Bravo! thanks @nielsgerrits​ :)


redgeographics
Celebrity
Forum|alt.badge.img+61

Bravo! thanks @nielsgerrits​ :)

To elaborate on @nielsgerrits​ answer: the @DateTimeNow() function gets evaluated per feature, so each feature will have a slightly different timestamp. Despite rounding it to seconds you'll still potentially get multiple values