cancel
Showing results for 
Search instead for 
Did you mean: 

Node Functions

Former Member
0 Kudos

Hi all,

Can anyone descibe the difference between 2 node functions Remove Context and Collapse Context?

Thnx

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ;

Remove Context

Use of this Function

We some times face a requirement when we need to pass the values present in different contexts within the same queue to a function. Example being passing the values to a context level User defined function which operates on the values within the same context.

We use removeContexts () to delete all the top level contexts for an element. This removes all top hierarchy levels, so that all elements of the target queue are assigned to a root element of the source queue.

Example:

Source Structure Target Structure

<DT_Source> <DT_Destination>

<Subject> 1…unbound <Total_Marks> 1…1

<Marks/> 1…1 </DT_Destination

</Subject>

</DT_Source>

Mapping Requirement

We need to fetch in all the marks and pass these in same context to a UDF which calculates the total of all these marks.

Mapping

Marks-- Remove ContextUDFTotal_Marks

Here we can see that all the marks coming into the remove Context function are in different contexts and the function has removed the context change and made all the marks come at a same context level.

Split By Value

Use of this Function

The SplitByValue () function is the counterpart to removeContexts(): Instead of deleting a context, we can insert a context change in the source value queue. We then receive this element for each inserted context change instead of a top node element. However, for this to be possible, the top node source field must be assigned a top node target field and minOccurs must be >0. A maximum of minOccurs top node target fields can be inserted here.

We can insert a context change in the queue after each value, after each change to the value, or after each tag without a value.

Example:

<DT_Source> <DT_Destinatio

<Subject> 1…1 <Subject> 1…unb

<Marks/> 1…unb <Marks> 1…1

</Subject> <Subject>

</DT_Source > </DT_Destination>

Mapping Requirement

We need to split out the marks values in the source structure to different contexts in the target structure.

Mapping

Marks-- SplitByValue--Marks

Here we can see that the marks coming in the Split By Value

Function are in the same context and this function is splitting out the marks values to different contexts.

Mudit

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

The follwing blog will explain clearly with example of your question

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

Best Regards,

Vijay

former_member529475
Active Contributor
0 Kudos

HI Koopmann,

<b>Remove Context</b>

Remove context removes all the higher-level contexts of a source field thereby delete all hierarchy levels and generate a list.In simple form

removes all top hierarchy levels, so that all elements of the target queue are assigned to a root element of the source queue

Check this link ...

http://help.sap.com/saphelp_nw04/helpdata/en/1f/ea0fb12403844bbb6c4cbc8a00cda9/content.htm

<b>Collapse Context</b>

Deletes all values from all contexts from the inbound queue except for the first value.Only one queue remains, which consists of contexts that contain just one value each. Finally, all internal context changes are deleted, so that all values belong to one and the same context

Check this link...

http://help.sap.com/saphelp_nw04/helpdata/en/4b/d11e3e1c3b120ae10000000a114084/content.htm

Cheers...

Vasu

<b>** REward Points if found useful **</b>

Former Member
0 Kudos

Hi,

Remove Contexts: Removes all higher-level contexts of a source field. In this way, you can delete all hierarchy levels and generate a list.

Collapse Contexts: Deletes all values from all contexts from the inbound queue except for the first value. Empty contexts (= ResultList.SUPPRESS) are replaced by empty strings. Only one queue remains, which consists of contexts that contain just one value each. Finally, all internal context changes are deleted, so that all values belong to one and the same context.

Regards

Shabarish_Nair
Active Contributor
0 Kudos