cancel
Showing results for 
Search instead for 
Did you mean: 

how to use .addContextChange?

Former Member
0 Kudos

hi all,

can someone please explains me how to use the method .addContextChange.

also i have a child node which can occurs unbounded times, i want to know how to use .addContextChange to replicate this child node.

thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member187339
Active Contributor
0 Kudos

Hi,

>>can someone please explains me how to use the method .addContextChange.

addContextChange is a providion of providing a context change in the output. This we need to use in a udf.

>>also i have a child node which can occurs unbounded times, i want to know how to use .addContextChange to replicate this child node.

if the maxoccurence of child node unbounded, then if you don't use addContextChange in udf all values will be put as child of same parent

eg :

-A

--1

--2

--3

if you use addContextChange after each value, the output will be

-A

--1

-A

--2

-A

--3

Regards

Suraj

Former Member
0 Kudos

hi all,

i thank u all for the quick reply. but suraj, i am not able to use the addContextChange properly hence am not able to determine when to use it and how to use it.

former_member187339
Active Contributor
0 Kudos

Hi,

For using it properly you need to understand what a context is how does it influence the output structure and what all ways are there to add it.

What a Context Change is

Message mapping in XI works by means of queues. A queue contains an entire XML instance of the source message. Depending on the hierarchy in the source message, different nodes and elements can be categorized into different contexts. All the nodes and elements that belong to the same parent node are said to be in the same context. Hence, the nodes and elements that belong to different parent nodes have to be separated by a context change.

Refer http://www.riyaz.net/blog/xipi-introduction-to-context-handling-in-message-mapping/

what all ways are there to add it.

1. By standard mapping functions Splitbyvalue,

2. For removing context collapsecontext and removecontext.

3. By UDF (as you mentioned)

Context is needed to align the output, so if you a correct output you need to handle the context

Regards

Suraj

Answers (4)

Answers (4)

Former Member
0 Kudos
Former Member
0 Kudos

Thank you all, i have able to finish my mapping. Thank a lot for the links you provided, via which i have been able to understand the node functions and context in xml mapping.

to solve my problem i have use splitByValue and a proper logic.

thank again.

Former Member
0 Kudos

Hi,

this blog should be helpful:

/people/harrison.holland5/blog/2006/12/08/mapping-context-changes-in-xi

Regards

Patrick

Former Member
0 Kudos

Hi ,

You can achive your aim by using node functions .

Addcontextchange() method will append a context change to the list .

Regards,

Jude

former_member200962
Active Contributor
0 Kudos

Check the reply from Bhavesh:

This blog should help you in writing your desired UDF: /people/rohit.kalugade/blog/2008/12/08/context-and-queue-in-message-mapping-udf

Regards,

Abhishek.