Skip to Content
0
Former Member
Jan 22, 2009 at 01:13 PM

Format Number function in PI 7.10 SPS 7

628 Views

Hi,

for those of you who used the FormatNumber function inside the Message Mapping, there is a quite strange change.

You must enter a decimal delimiter. Inside release 7.00 this was not a must. The error message you will receive from the mapping is a little, well, unusefull:

Check result for Message Mapping: MM_OSRBG_PP_SFC_TECO_RFC_REQUEST | http://osram-os.com/rbg/pp/sfc/teco/xi013:

Target field mapping '/ns0:MT_OSRBG_PP_SFC_TECO_RFC/ROW/ORDERID' incomplete; reason: char should be not empty

Well on my side the lead to several problems, because I had to assign fixed number length (without decimal digits).

The only solution I had on this is to build an own user function in java doing the same.

These are the two parameters given to the function:

numberString

numberFormat

You have to import this:

import java.text.*;

And that's the code:

int numberInteger = Integer.parseInt(numberString.trim());

DecimalFormat piNumberFormat = new DecimalFormat(numberFormat);

return piNumberFormat.format(numberInteger);

BR Markus