cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Challenge

former_member200267
Participant
0 Kudos

Hi Experts,

Coud anyone help me to map the below requirement:

Source structure :

B................................(0..unbounded)

-satzart (0..1)

-Index (0..1)

-Fehlercode (0..1)

Target structure :

A.............(0..unbounded)

-satzart (0..1)

-rgnumber (0..1)

-Fehlercode1 (0..1)

-Fehlercode2 (0..1)

-Fehlercode3 (0..1)

Source file:

<B>

<Satzart>G60</Satzart>

<Index>B</Index>

<Fehlercode>12D1 ME9999W</Fehlercode>

<B>

<B>

<Satzart>G60</Satzart>

<Index>B</Index>

<Fehlercode>12J1 ME9999W</Fehlercode>

</B>

<B>

<Satzart>G60</Satzart>

<Index>B</Index>

<Fehlercode>50A1 ME5000W</Fehlercode>

</B>

The above file has to be mapped to the target structure like follows:

<A>

<Satzart>G60</Satzart>

<rgnumber>B</rgnumber>

<Fehlercode1>12D1 ME9999W</Fehlercode1>

<Fehlercode2>12J1 ME9999W</Fehlercode2>

<Fehlercode3>50A1 ME5000W</Fehlercode3>

</A>

the source field Fehlercode under B node has to be mapped to the target fehlercode1,fehlercode2,fehlercode3.

i.e: the first occurrence from source has to be mapped to Fehlercode1

and second occurrence has to be mapped to Fehlercode2

and third occurrence has to be mapped to Fehlercode3

If more than three occurrence the next can be ignoredu2026

Please help me how to achieve this in mapping.

Regards,

RDS

Edited by: Shankar Raju Devadoss on Jul 16, 2008 5:00 PM

Edited by: Shankar Raju Devadoss on Jul 16, 2008 5:01 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use the following UDF to achieve this requirement:

UDF_1(source Fehlercode queue, index number){

return fehlercode(index no);

}

This is the UDF for Fehlercode1. Use the similar UDF for remaining target fields with changing the index numbers respectively.

Regards

Bhanu.

Edited by: Bhanu Tiruveedula on Jul 16, 2008 10:05 PM

Answers (4)

Answers (4)

justin_santhanam
Active Contributor
0 Kudos

Shankar,

Please try this

satzart --> Satzart

Index --> rgnumber

Fehlercode -->RemoveContext >CopyValue[0]> Fehlercode1

Fehlercode -->RemoveContext >CopyValue[1]> Fehlercode2

Fehlercode -->RemoveContext >CopyValue[2]> Fehlercode3

You can find CopyValue under Constants function. If it doesn't help then let me know.

Thanks,

raj.

Former Member
0 Kudos

Hi,

Map

Satzart --- > satzart

Index -


> rgnumber

For 3rd field Create UDF of type Queue,

ForFirstField(String val[])

{

result.addValue(val[0]);

}

ForSecondField(String val[])

{

result.addValue(val[1]);

}

ForThirdField(String val[])

{

result.addValue(val[2]);

}

Here the UDF is of Queue type so we can add return value to result.

Here you can map ForFirstField udf to Fehlercode1.

Here you can map ForSecondField udf to Fehlercode2.

Here you can map ForThirdField udf to Fehlercode3.

Former Member
0 Kudos

Hi,

Use the following UDFs to achieve this requirement:

UDF_1(source Fehlercode queue){

return fehlercode(1);

}

UDF_2(source Fehlercode queue){

return fehlercode(2);

}

UDF_3(source Fehlercode queue){

return fehlercode(3);

}

Use these three UDFs for three target fields.

Regards

Bhanu.

former_member181962
Active Contributor
0 Kudos

Write an UDF to get this.

Input is the array for B->Fehlercode and

the index_number (1,2,3)

return a[index_number]. (Here a is the array name for the input 1)

Use this java UDF function with index_number as 1 for first 2 for the second and 3 for the third.

Regards,

Ravi