Question

date parameter

  • 7 February 2014
  • 15 replies
  • 36 views

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

Userlevel 4
Badge +13
Hi,

 

 

Have you passed the parameter via the DateFormatter?
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.
Userlevel 4
Badge +13
I am not a MapInfo user, hopefully one will pick up this thread.

 

What is the date format used in MapInfo?
Hi, MapInfo will interpret 20140131 as a valid date (it shows up in a date field as '31/01/2014'.
Userlevel 4
Badge +13
Have you tried the following destination format : %d"/"%m"/"%Y in the DateFormatter?
Just then - same result.
Badge +21
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.
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.
Userlevel 2
Badge +17
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
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'.
Userlevel 2
Badge +17
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 ;

 

-----
The output TAB file shows the column as character:

 

 

AsAt Char (8) ;

 

 

the writer in the 'User Attributes' section has:

 

 

AsAt Date
Userlevel 2
Badge +17
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.
Thanks for your thoughts. I will look at putting it back to SAFE.

 

Thanks all.
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.

Reply