Questions about flow

Hi guys,

I am new in webmethod and have some questions about the flow.

Currently I am going to handle a xml and transfer it into another format. And it need to process a value field. Actually it is a list of attributes, have names and values. And the value could be anything, number or string

if the value is number, I need to change it into a format like 1.0000000000000000E+2(for 100.0). I know it’s silly to have 16 zero afterwards, but what more ridiculous is they need it.

change the format is not that hard, the point is how to distinguish whether the value is a string or a number.

what I work on is webmethod 4.0, very old version. I think there is no logic expression in BRANCH or the other operations. I am also trying to write a small program on java, but It appears

public static final void number_handle( IData pipeline ) throws ServiceException
{

as the beginning, I am not sure how to change this. So I am totally lost here.

pub.string:numericFormat

I also use this function. But the problem is once the numericFormat find out the input is not a number, it throw an error and the program stops.

and also I need to transfer the 100.0 to 1.00000000000000E+02. does the numericFormat have that function?

Yes, it throws an exception if you pass a non-number. Either catch it or verify that the value you pass is not null, empty or a non-number before calling.

Use this as the pattern: 0.000000000000E0

You won’t be able to get E+02 with this service, so you may need to do search and replace after calling this.

Also, be aware that this service uses a double data type. This can cause accuracy issues depending on what you’re doing.

Finally, here’s the description of java.text.DecimalFormat, which is what numericFormat uses to do its work.
[URL=“JDK 19 Documentation - Home”]JDK 19 Documentation - Home