cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Conversion

Former Member
0 Kudos

I am mapping

X string -> Y Decimal

how to convert string to decimal

is there a function

Jeff

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Jeff

If you are using Graphical Mapping then XI will take care of conversion itself. You don't need to write any program explicitly.

But you need to do couple of validations because in case Source System will send NULL value ( which is allowed for String data type ), XI will generate mapping exception so for this during mapping you can check for NULL value & put constant value 0.

Also if you want to check whether this String value has all digits in it or not, you can write following simple UDF -->

<i>String str

if ( Integer.parseInt(a)==1){

str=a;

}

else

str=-1;</i>return str;

}

// then u can consider -1 as error value which you can check in Target system

Pls. keep in mind using UDF in graphical mapping you can only return String type value.

- lalit -

Former Member
0 Kudos

Hi,

I an using fixed value mapping function and passing a value.

while i am doing testing in message mapping editor it displays target values.

i gave default value as 0.

when reaching 3rd party system it is going as 0 even if then source value exists.

is there a way i can ebug and check wats the issue

Jeff

Former Member
0 Kudos

Jeff

Seems that you are not putting the validation in correct way.

In my mapping between String PARNR( Source ) & Long DriverID( Target ), I used this logic -->

/ns1:DriverID=iF(const([value=0]), stringEquals(/ns0:PARNR=, const([value=])), /ns0:PARNR=)

In programmitical way you can put it like this -->

If ( PARNR == NULL )

then

DriverID=0

else

DriverID=PARNR

- Lalit -

Former Member
0 Kudos

HI,

I mean.

i am using "Fixed value" function

to pass conditoin values to target.

its fine in message mapping

but ...even if we have source value in target it is going as default values. it is not picking up value from Fixed Value function

JEff

Former Member
0 Kudos

Hey

test ur message mapping under the test tab in interfac mapping and also by using the Payload from SXMB_MONI and see if ur getting correct results

thanx

ahmad

Former Member
0 Kudos

Jeff

Seems to be some issue with validation logic you are using in your mapping.

I suggest you to try different things like

*) Don't use the default value logic & execute ur scenario with this you will be able to know whether the problem with FixedValue function or not.

Also are you sure you are providing the "Keys" from Source system which you are mentioning under the Key column of FixedValue function property.

- Lalit -

<i>**** Pls. provide points to comments which in either way helping you to move ahead with your problem. This way others who will take notice of this thread in future knows what to do & what not *****</i>

Former Member
0 Kudos

Hi,

I am not sure about Keys..

could you explain its functionality

thanks

Jeff

Former Member
0 Kudos

Hi Sorry,

i misunderstood ur answer..

yep i am providing key values

Jeff

Former Member
0 Kudos

Just to make sure one thing, you are giving 0 as a default value in FixedValue function or you are putting a different validation for this.

If you are giving 0 as default in FixedValue then can you remove it & check what would be the output.

In such I would suggest you try different settings & try to pin-point where the issue is.

- Lalit -

Former Member
0 Kudos

Jeff,

Define your source datatype as string and target datatype as Decimal for the corresponding field.

---Satish

Former Member
0 Kudos

Hey satish

just out of curiosity,does XI does implicit type conversion?

thanx

ahmad

Former Member
0 Kudos

Hey

use a simple UDF for this,simply convert the datatype for the sender.do a typecasting.

thanx

ahmad