ConvertToString and decimal points

We have a value, 00000054321 that we pass into a mapping from a flat file

We use a number of transformers to clean up the data, but the last transformer (formatnumber) converts the value to 0.54321

When we trace it through the mapping everything is fine until we pass it through the ConvertToString function.

At this point the output becomes 0.

If we set the value in the Flat file to be 0.54321 and do not use the last transformer (formatnumber), the correct value 0.54321 comes out from ConvertToString.

I am sure that whatever we are doing it is something quite silly.

Any suggestions? Webmethods Developer 8.2

Paul

Hi,

What is your input and expected output?

Kindly share few examples. This can be fixed not a big issue at all :slight_smile:

Hi Maheesh

Thank you for getting back to me. The values are those given in the post.

The input value from the flat file is 00000054321 and the expected output is 0.54321

We have a transformer with the following settings:

fornatpattern : 0.#####
removedecimalforimplied : false
addexplicitdecimal : true
adddecimalmultiplier : 0.00001

With these settings I get a 0.

If I set addexplicitdecimal to false, I get 54321.

If I create a flat file that contains 0.54321 instead of 00000054321 and do not formatnumber, I get 0.54321.

Clearly convertToString is doing something, but I don’t know what. It must have something to do with how the original input value is being treated.

Clearly I have a workaround as explained above, but that will cause me problems in other processes. Better to get this working.

Thanks,

Paul

Paul,

I suggest to use the format service for the field in the dictionary

In this service you can implement the complete logic for transformation. In the convertToSTring service you give the corresponding schema.

Its working when I tested. Let me know if any issues.

/Naidu
sde.jpg