Skip to main content
Question

date parameter


Hi

 

 

I am trying to add a single date as a published parameter to my FME workspace and write this to a column in a MapInfo TAB format output table. I set the parameter to "20140131" and set the value of the Date field in my output table to this parameter. But the field in my output table is changed to a character type. How can I fix this so the field remains a date?

 

Thanks.

15 replies

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • February 7, 2014
Hi,

 

 

Have you passed the parameter via the DateFormatter?

  • Author
  • February 7, 2014
Hi,

 

Thanks for the reply.

 

Yes, I have - I've tried a few different cominations (e.g %Y%m%d) for 'Source Date Format:' and 'Destination Date Format:' without any success.

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • February 7, 2014
I am not a MapInfo user, hopefully one will pick up this thread.

 

What is the date format used in MapInfo?

  • Author
  • February 7, 2014
Hi, MapInfo will interpret 20140131 as a valid date (it shows up in a date field as '31/01/2014'.

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • February 7, 2014
Have you tried the following destination format : %d"/"%m"/"%Y in the DateFormatter?

  • Author
  • February 7, 2014
Just then - same result.

sigtill
Contributor
Forum|alt.badge.img+24
  • Contributor
  • February 9, 2014
and on the WRITER Schema you have defined the attribute type as DATE? From the help regarding date formats:

 

 

date

 

 

This is used to store and retrieve date information within a Geodatabase.

 

 

When a date field is read by the Geodatabase reader, it is placed in the FME feature with the form HHMMSS, YYYYMMDD, or YYYYMMDDHHMMSS. The time portion is specified using the 24-hour clock. When writing, the date attribute must also be in one of these three forms. These forms are compatible with all other FME dates.

 

 

When the Geodatabase writer creates a new table, all the fields, except for the object ID field, will be defined as allowing null values.

  • Author
  • February 10, 2014
Hi,

 

 

Yes, the writer field is set to the 'Date' type in the [MITAB] (MapInfo) writer.

 

This somehow is converted to a character type in the output table.

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • February 10, 2014
Hi,

 

 

Although FME treats dates as character strings while translating, the Writer will convert date strings (typically "yyyyMMdd" format) to date values automatically when writing them into Date type field of destination dataset, as far as I know.

 

How did you confirm that the values which have been written into the Date type field were still character strings?

 

 

Takashi

  • Author
  • February 10, 2014
I opened the output MapInfo table in MapInfo and saw that the column type was 'character' of length 8. The content was as per the parameter - '20140131'.

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • February 10, 2014
Since I don't have MapInfo unfortunately, cannot confirm that on MapInfo application. But contents of "tab" file (i.e. schema definition of the destination dataset) can be seen with a text editor.

 

This is raw contents of a "tab" file which I wrote with the FME MAPINFO writer. I specified "date" as type of "NewField" when writing, it looks to be distinguished clearly from other Char type fields. How's your "tab"?

 

-----

 

!table

 

!version 300

 

!charset WindowsJapanese

 

 

Definition Table

 

  Type NATIVE Charset "WindowsJapanese"

 

  Fields 6

 

    N03_001 Char (10) ;

 

    N03_002 Char (20) ;

 

    N03_003 Char (20) ;

 

    N03_004 Char (20) ;

 

    N03_007 Char (5) ;

 

    NewField Date ;

 

-----

  • Author
  • February 10, 2014
The output TAB file shows the column as character:

 

 

AsAt Char (8) ;

 

 

the writer in the 'User Attributes' section has:

 

 

AsAt Date

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • February 10, 2014
hmm... I cannot reproduce the issue as same as yours in my environment (FME 2014 build 14235). The writer always creates Date field in "tab" file if I specified "date" type on the writer feature type.

 

It might be better that you contact Safe support with attaching the data and workspace in which the issue can be reproduced.

  • Author
  • February 10, 2014
Thanks for your thoughts. I will look at putting it back to SAFE.

 

Thanks all.

  • Author
  • February 10, 2014
Hi again all,

 

I think I have found the problem. It appears to be an issue with the 'MITAB' writer. Those familiar will know that there are 2 MapInfo writers - MITAB (open source) and MFAL or just MAPINFO as it now appears in FME2014. The issue only occurs with the MITAB writer.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings