Getting the String representation of a Double variable

I have this variable called ‘Amount’, which is of type double. This goes in as an input to a JDE Business Function (which takes only String values). When the ‘Amount’ variable has a value like ‘345678.76’, this goes in perfectly into JDE. In case of a larger amount, the Double variable implicitly converts it to an exponential format (‘4.52E7’). When this value is passed onto JDE Business function, it throws a numberFormatException.

Is there any way I can get a String representation of teh Double 4.52E7 (i.e. ‘45200000’), so that it goes into JDE smoothly?

You can use java.math.BigDecimal to do the conversion work for you. The specifics of how to instantiate a BigDecimal object and use it will depend on what webMethods tool set you’re using.

You should strongly consider changing the data type of ‘Amount’ from double to string. There is an eZine article (http://www.wmusers.com/ezine/2002oct1_reamon_1.shtml) that describes the issues using float and double and possible solutions.