cancel
Showing results for 
Search instead for 
Did you mean: 

message mapping between the string and decimal

Former Member
0 Kudos

Hi ALL,

I have a requirement were have to map between the idoc and xsd.

the problem I'm facing while mapping is the data type conflict. since both side(source and target) are standard, so can't change the data type .

the source is a string and target side we have decimal.

we are mapping source_element(string) to dest_element(decimal) and error mapping not possible.

so if anyone know the solution for this please let me know.

Thanks in Advance,

Lalit

Accepted Solutions (0)

Answers (4)

Answers (4)

stefan_grube
Active Contributor
0 Kudos

No matter what you have in XSD, the XML representation of any type is a String.

So all you have to do is to make sure that your target has correct format 1234.56

When your input value has another foramt like 1,234.56 or 1.234,56 you can have the correct output with easy string manipulations (replaceString)

Former Member
0 Kudos

Hi,

You can write a UDF to do this for you.

Execution type: Single values.

Under Signature variable:

Argument var1 string

Code:

String s = var1

try

{

float f = Float.valueOf(s.trim()).floatValue();

}

catch (NumberFormatException nfe)

{

System.out.println("NumberFormatException: " + nfe.getMessage());

}

return f;

stefan_grube
Active Contributor
0 Kudos

> Code:

> String s = var1

> try

> {

> float f = Float.valueOf(s.trim()).floatValue();

> }

> catch (NumberFormatException nfe)

> {

> System.out.println("NumberFormatException: " + nfe.getMessage());

> }

>

> return f;

Have you tried this code? This will not work.

Former Member
0 Kudos

What is the exact error you are getting?

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi,

First convert string to decimal using UDF,then map UDF out put to target.

search in google for java code to convert string to decimal.

or

if your bussiness people accpets string value at target side means,change xsd filed type to string in XSD,this will solve your problem too..

but i prefer first one.,

Regards,

raj