Question

Leading and Trailing Zeros being Stripped off

  • 17 October 2017
  • 4 replies
  • 30 views

I have a number of columns that contain data that can have the following values (0.25, 0.5, 0.75, 1.0, 2.0, 3.0 and 4.0) These are the only acceptable values but the leading and trailing zeros are being stripped off when the data runs through the FME script. How can I ensure that this does not happen?


4 replies

Badge

Hi @jonlibby

what is your destination format? Do you see the numbers correctly in the output? What is the destination attribute data type?

You can always use StringFormatter to format your values - the transformer will convert them into strings, but this won't cause any problems even if you will need to use them as numbers later.

I am using two versions of FME, 2017.0.1 and 2017.1. Oddly, the 2017.1 FME script does not exhibit the lead/trail zero issue, only the 2017.0 version. There are some differences in the two scripts as some of the date time transformers don't exist in 2017.0 but otherwise, almost identical.

Userlevel 2
Badge +17

Hi @jonlibby, when an attribute value is being treated as a numeric value internally, leading or trailing zeros might be trimmed when it is shown on the Log or the Table View in Data Inspector. For example, "001" and "1.00" both might be shown as "1".

However, by default (Automatic mode), FME considers both "001" and "1.00" as the same value "1", and I think it would not cause any problem in many scenarios.

What is your specific problem regarding the zero trimming?

Badge

Hi @jonlibby

are these datetime values? Do you use datetime transformers and functions in FME 2017.0 and FME 2017.1?

The new datetime functionality was introduced in FME 2017.0. Some of it was implemented only by the FME 2017.1 release, so indeed some of the datetime transformers and functions are not available in FME 2017.0. Also, there were minor tweaks in FME 2017.1 which we introduced to improve user experience.

If you are not happy with FME 2017.1 results, please share your workspace and let's try to fine tune it. If FME 2017.1 produces the desired output, please consider switching to 2017.1 completely.

Reply