Former Member

Mapping problem.

I have the following problem.

Source structure:

```<header>
<segment>
<value1>A</value1>
<value2>B</value2>
</segment>
<segment>
<value1>C</value1>
<value2>D</value2>
<segment/>
<segment>
<value1>E</value1>
<value2>F</value2>
<segment/>

If the field value1 concatenated with value2 is equal to CD somewhere in the source structure then I want to produce the following target.

```<header>
<indicator>X</indicator>

If the source structure value fileds concatenated is equal to XY then the following target.

```<header>
<indicator>B</indicator>

Otherwise the following target.

```<header>
<indicator/>

How would I solve this with a gra

10|10000 characters needed characters exceeded

• Former Member
Dec 09, 2009 at 01:26 PM

its better to write a UDF just for checking the condition instead of going for the if else of graphical mapping

jsut pass the value of the concat function to the UDF and in the UDF put a condition

String a =" ";

if( value.equals("CD"))

{

return X;

}

else if (value.equals("XY"))

{

return B;

}

else

{

return a;

}

HTH

Rajesh

10|10000 characters needed characters exceeded
• Former Member

Just trying to avoid UDF's.

But if this is the solution then it is.

BR

Kalle

• Former Member
Dec 09, 2009 at 01:32 PM

It is a very simple logic..

Concatenate (Value1 & 2) --> equalS (CD) --->ifWithOutElse --> Then ---> map a constant 'X' to target field.

same logic for XY.

Regards,

Sarvesh

10|10000 characters needed characters exceeded
• Former Member Former Member

Hi Kalle,

Here PARVW = value1, PFACH = value2 and target = FromName

I have checked this, its working fine.

If target element comes multiple then use split by value other wise you can delete.

Here i used the map with default value, bcz if some times the field value not come then it takes the default value otherwise take some wrong value.

Regards

Ramesh

• Former Member
Dec 09, 2009 at 01:39 PM

Hi,

value - 1 map with default

value - 2 map with default concatenate --> equalS (CD) --->ifWithOutElse --> Then ---> map a constant 'X' to target field.

Here value1 and value2 should be in the same context.

Regards

Ramesh

10|10000 characters needed characters exceeded
• Former Member
Dec 09, 2009 at 01:42 PM

Hi,

In place of UDF you can also use conversion function FixValues.

By passing concatenated value as key and required value in value column it can be done easily.

Example: CD as key and X in value column.

Keep the default value as space to generate the target.

Thanks and regards,

Sandeep Jaiswal