cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping Requirement

Former Member
0 Kudos

Hi Experts,

I have a mapping requirement in which the source and target structure is attached to this post.

Please have a look.

Here E1EDKT1 is the node

---------------->TDID is the Element in E1EDKT1

---------------->E1EDKT2 is the sub node of E1EDKT1

---------------------------->TDLINE is the Element in E1EDKT2                                

          

The source structure contains more than 1 nodes of E1EDKT1 i.e.., E1EDKT1 occurs many times .....And similarly the sub-node E1EDKT2 occurs "n" times in each time E1EDKT1 occurs.we dont know what the exact value of "n"

In the node E1EDKT1 , TDID is the ID which decides the target element..

The Target Element SELLO is the Concatination of the TDLINE (i..e...,TDLINE +TDLINE+TDLINE+........) if TDID =A

The Target Element CERTIFICADO  is the Concatination of the TDLINE (i..e...,TDLINE +TDLINE+TDLINE+.....) if TDID =B

And Here TDLINE +TDLINE+TDLINE+.... means the concatination of each TDLINE value in the each sub node E1EDKT2  that means concatination  of the "n" TDLINE values comes in "n" number  of the sub node E1EDKT2.....

the Source Xml is also attached.

Suggestions are highly appreciated....

Thanks in Advance

Venkat.

Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Venkat,

                   Could you please try this mapping

TDLINE context should be set as shown

the UDF Title code of type context to concatenate the values of TDLINE

public void ConcatVal(String[] b, ResultList result, Container container) throws StreamTransformationException{

     int i,j;

     String sa="";

     for(j=0;j<b.length;++j)

     {

         sa=sa+b[j];

     }

        result.addValue(sa);

}

UDF signature

Hope this resolves the problem

Regards

Anupam

Former Member
0 Kudos

Hi Anupam,

Thanks for the Reply .

But it is not working as there are different TDID values

depends on the TDID values ,it is sending the concat string to different attributes(not element in the target)

Please help me out of this(As this is an urgent Development which is to be delivered)

Thanks,

Venkat

Former Member
0 Kudos

The solution looks good to me. First eliminate from the queue all elements not equal to A or B, then concatenate all elements in the remaining queue. That should be your approach, I would also suggest this.

Regards,

Jörg

anupam_ghosh2
Active Contributor
0 Kudos

Hi Venkat,

               In the target XSD I used attributes and not element.

Could you please provide a complete picture of the target.  Let me know the different TDID values so that mapping may be altered. Also please confirm if the target side concat values are correct for TDID ="A" and "B" according to above mapping.

Regards

Anupam

Former Member
0 Kudos

HI Anupam,

Its working when i added a mapwithdefault node function at the end..

Thanks a lot Anupam..

Regards,

Venkat.

anupam_ghosh2
Active Contributor
0 Kudos

you are always welome Venkat.

Answers (1)

Answers (1)

former_member184789
Active Contributor
0 Kudos

Hi,

You  need to make a small change in the solution suggested by Anupam. The UDF Title should come after the IfWithoutElse function, not before it. Thus for the ifWithoutElse the input for if is TDID equalsS A or B and in 'then' pass TDLINE in higher context. After the ifWithoutElse function have this UDF.

Former Member
0 Kudos

Hi all,

Thanks all for ur helpful answers.

Regards,

Venkat