span8
span4
span8
span4
In this article,we will perform a couple of translations demonstrating how to use date/time attribute values in destination filenames.These 亚搏在线workflows are useful in scenarios such as Status Reports,Work Schedules,and Maintenance Schedules.
This article helps you to understand the following:
File-based formats such as GML,DWG,DGN,can assign data to different layers within a single file usingDataset Fanout.In this example,we will create an attribute,then useDateTimeStamperandDateTimeConvertortransformers to generate an ACAD output file with the first 3 letters of a month in the filename.The complete workspace is available in Downloads section (date-in-file-based-ex1.fmwt)
Open FME Workbench and click on Generate Workspace.
Complete dialog,using the following information:
Reader Format:MapInfo TAB
Dataset:Parks.tab (see Downloads section)
Writer Format:MITAB
Dataset:C:\Temp\Output\Parks.dwg
The input data have no attribute with date values,so we are going to add a date attribute.Add aDateTimeStampertransformer on the canvas and insert it between reader and writer feature types.Set the transformer properties as follows:
Set Result Attribute to _month.
The attribute created by the DateTimeStamper stores system-generated current date asYYYYMMDD
As_monthattribute stores date in formatYYYYMMDDand we want output filenames to contain the first three letters of a month.To achieve this,we will use DateTime functions.Add aDateTimeConvertorand connect it to theDateTimeStamperoutput port.
Set the transformer properties as follows:
Datetime Attributes: _month
Output Format: %b
NOTE: Expand Quick Reference to check all the functions available
The next step is to use the newly generate date attribute in the destination file name usingdataset fanout.Connect the output port of DateTimeConverter to ACAD writer.
Parks_@Value(_month).dwg
Run the workspace by pressing F5 clicking on Run button on the toolbar.Confirm that the result as shown under Result
The workspace after completion should appear as below.
Run the workspace and open the Output directory.Notice that the file name contains the month value as expected.
This example includes folder-based writers such as SHAPE and MITAB (formats that do not have a way to assign data to different layers within a single file).For this exercise,we are going to useDateTimeStamperin conjunction withfeature-type fanout.TheDateTimeStamperadds a date to our features,and feature-type fanout generates separate files based on that date value.The complete workspace is available in the Downloads section (date-in-folder-based-ex2.fmwt)
Open Workbench and click on Generate Workspace.
Reader Format:MapInfo TAB
Dataset:Parks.tab (see Downloads section)
Writer Format:MITAB
Dataset:C:\Temp\Output\Parks.tab
The input data have no attribute with date values,so we are going to add a date attribute.Add aDateTimeStampertransformer on the canvas and insert it between the reader and writer feature types.
Set the transformer properties as follows:
Type: Date
Result Attribute: _timestamp
The attribute (_timestamp) stores system-generated current date asYYYYMMDD
The next step is to use this newly generated date attribute to name destination file usingfeature-type fanout.
Run the workspace by pressing F5 clicking on Run button on the toolbar.Confirm that the file is written with date,as shown under Result
The workspace after completion should appear as below.
Run the workspace and open the Output directory.Notice that the file name contains the current date.
Please follow the link for more information onData Fanouts
The data used here originates from open data made available by theCity of Vancouver,British Columbia.It contains information licensed under the Open Government License - Vancouver.
This article is very helpful to me,Thanks.
I have tried many ways but not success,$(FME_BUILD_DATE) gives another date.
In my FME that Fanout gives me option in another way.
Hi@surendermca04Thanks for touching base.Yes,the article was created with a newer version of FME.Can you tell me what version of FME you are using?
Then I'll do a quick test in that version to confirm what will work.
Hi;I am trying to use the fanout timestamp option with an HTML report,but am not having much luck.My output file is PopulationReport.html.I'm hoping to set it so that when my model runs,it saves a new report with a timestamp at the end of the name,much like the .dwg example in this write-up.
My fanout for the html writer looks like this:
The text editor portion of the fanout dialogue is as follows:
The timestamp attribute is not recognized.
Any thoughts or suggestions?
Thanks!
Eugene D.
My guess is that you are using the HTMLReportGenerator to create your HTML page.HTMLReportGenerator only passes through the attributes used on the "Group By" parameter,and the html_content attribute that contains the HTML report.If your _datetime_forFilename attribute is not included in the HTMLReportGenerator "Group By" parameter,the HTML writer won't see it so it can't be used in the fanout.To work around this,your options are:
Which option you use will depend on the layout of your workspace.I've attached a workspace example.HTMLWriterFanoutExample.fmw
Working with Database Date | Time attributes
Tutorial: Working with Date and Time Attributes
Handling Local Timezones,UTC,Daylight Savings Time,and Leap Units
DateTimes and FME: FAQs and General Information
Performing spatial queries on database tables using the FeatureReader
Polling Places for Local Government
Working with Foreign Keys: Writing Database Tables
© 2019 亚搏在线Safe Software Inc |Legal