cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping descrete values to childs of a complex type array

Former Member
0 Kudos

Hi all,

I have the following flat XML file with descrete values as source:

<MaterialRequest_MT>

<number><b>number1</b></number>

<shortdesc><b>shortdesc1</b></shortdesc>

<projectname><b>projectname1</b></projectname>

</MaterialRequest_MT>

My problem is how to map this file to the following destination file where the single values of the source file are values of a child element in a list of complex elements:

<ns0:query xmlns:ns0="http://QueryService">

<ns0:attributes>

<ns0:item>

<ns0:key>

<ns0:system>MP</ns0:system>

<ns0:name>PartNumber</ns0:name>

</ns0:key>

<ns0:value><b>number1</b></ns0:value>

</ns0:item>

<ns0:item>

<ns0:key>

<ns0:system>MP</ns0:system>

<ns0:name>Description</ns0:name>

</ns0:key>

<ns0:value><b>shortdesc1</b></ns0:value>

</ns0:item>

<ns0:item>

<ns0:key>

<ns0:system>MP</ns0:system>

<ns0:name>Project</ns0:name>

</ns0:key>

<ns0:value><b>projectname1</b></ns0:value>

</ns0:item>

</ns0:attributes>

</ns0:query>

As you see I don't have a source array over which to iterate. This makes it impossible to me to map the source values to the destination items.

Any help is very appreciated!

Thanks!

Denis

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Suneel,

unfortunately I have actually 17 elements to add. I just took three to simplify my problem. My problem is now that the maximum number of input parameters is limited to 9

Any clue how to solve this?

Thanks!

Denis

former_member605561
Participant
0 Kudos

Hi Denis

In that case is it possible to use 3 user defined functions. 9 inputs going to 1st userdefined function, 8 inputs going to 2nd userdefined function(UDF), 1st UDF and 2nd UDF output going to 3rd userdefined function.

regards

Suneel

Message was edited by: Suneel

former_member605561
Participant
0 Kudos

Hi

<b>Mapping for item node:</b>

Create a user defined function with 3 input parameters for number,shortdesc,projectname. In the user defined function check whether each input value exists or not.if the input value exists add the code 'result.addValue("")'.if the 3 input values exist then 3 item nodes will be created.

<b>Mapping for elements</b>

Create another user defined function with 3 parameter.take the 3 input values same as the above function. Check whether parameter a value exists in the element and write <b>result.addValue(a[0]);</b>Do similarly for b and c parameters. After defining this function add standard node function 'splitbyvalue' and assign to the target.

USedefined function---->splitbyvalue--


>value.

I guess this solution is a bit complex.....hope it works

regards

Suneel

Message was edited by: Suneel

Message was edited by: Suneel