cancel
Showing results for 
Search instead for 
Did you mean: 

segment missing - mapping needed

Former Member
0 Kudos

Hi,

I have a segment node in the incoming IDoc which is not mandatory. IDoc can come with this node absent.

The node has got child elements which are mapped to target structure elements.

I need an empty value in the target element, if the node itself is missing.

Means I want to check the existence of node, and if the node is absent, I want a space to goo to the target element.

How can I handle this? Please help.

Thanks,

John

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

You can try this,

SourceNode->CollapsContext->target

the context of SourceNode must be at lowest level,

Regards,

Rohit.

Former Member
0 Kudos

Hi john,

Use this screenshot and apply the same Logic present in this.But i used this for Different purpose and apply the basic logic of this

http://img208.imageshack.us/img208/6794/existsuz1.jpg

Regards

Seshagiri

Former Member
0 Kudos

You can use the 'exists' node function and populate a blank value in the target if the required node does not exist.

former_member192892
Active Contributor
0 Kudos

Source node->mapwithdefault->target

Use these for all your target mappings. Set the defult value in map wid default as blank

Former Member
0 Kudos

I cannot use map with default.

The target element is already mapped through a complex user-defined function.

Remember that I am not mapping an element field.

I have to map a root node to a target element, inserting a context.

I think only a java user-defined code can do.

Thanks,

John

Former Member
0 Kudos

I think you have already mapped source element to complex user define function to the target node.

Here use "MapWithDefault" function between source element and user defiend fucntion and set the source context to the parent node.

Now check this existance in the user defiend fucntion.If you will get empty value return the empty message(return "" or result.addValue("") depends on type of UDF). If you get normal value it performs the normal logic what is there in the logic.

Former Member
0 Kudos

String val = " ";

int count = 0;

for(int i=0;i<a.length;i++)

{

if (c<i>.equals("FALSE"))

{ val = "value";

count = count +1;

result.addValue(val);}

else if (c<i>.equals("TRUE"))

val = b[i-count];

result.addValue(val);

}

Hi,

The above code is returning no values. What couls be the reason?

If it works, my problem may be solved.

Thanks,

John

Former Member
0 Kudos

It looks like you are using simple user defined function in mapping.So you have to return a value using return statement.

result.addValue statement is used to return advanced UDF values.

Former Member
0 Kudos

Use "Map with default" standard function for all the child elements to the target elements in the message mapping.