0

I'am reading a fixed lenght file with "Text File input" step. In a position i have a number, let's say: 0000001234 I need to read this number like 1,234, with 3 decimal values.

There is an option to do that? I'have tryed with precision and decimals in the field section of the stp, but they don't work.

Daniele Licitra
  • 1,520
  • 21
  • 45

1 Answers1

0

Hopefully someone has a more elegant way for this, but you can do it with a calculator step (now improved per marabu's comment).

  1. Make sure your input field is a number type, not an integer.
  2. Add a Calculator step.
  3. Configure a new field "divisor" of type "set field to constant A" and type 1000 under "Field A". Set Remove to Y.
  4. Configure a second field of type "A / B", with A your data field and B the divisor field.
Cyrus
  • 2,135
  • 2
  • 11
  • 14
  • 1
    No need for a separate step to add the divisor, since Calculator can do that, too. I expect a slightly better performance from a Java-Expression, though. – marabu Feb 05 '17 at 13:35
  • Learned something new again! So you can indeed create a temp field inside the calculator and set it to constant value A (enter 1000 in field A). I only tried entering 1000 directly in field B of the A / B calculation and that doesn't work. – Cyrus Feb 06 '17 at 07:52