cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue

Former Member
0 Kudos

Hi All,

My source structure is

<root>

<a></a>

<type>

<val1>

</val1>

</type>

</root>

Here the cardinality goes like this

<a> 1..1

<type> 1..unbounded

<val1> 1..1

Target structure

<test>

<action>insert</action>

<table>table1</table>

<access>

<tval></tval>

</access>

</test>

My requirement is if field a's value is "const" I need to have <access> node in my target struct as many times as <type>. I tried mapping <type> to <access>

I used a 'if with out else' to map <tval>. The mapping is like

condition part of 'if with out else' --> check <a> equals "const"

then part 'if with out else'--> <val1>

Result part of 'if with out else' --> <tval>

The problem here is, <access> node is created as many times as <type> but <tval> is created only for the first <access> node.

Can you help me out.... This is a bit urgent.. Pls do reply...

Thanks & Regards,

Jai Shankar.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Please use something like that in your target access

element:

a)

for your <access> element use ifWithoutElse

condition:

useOneAsMany(equals(<a>,'const'),<type>,<type>)

input:

<type>

b)

for your <tval> element direct mapping

<val1> -> <tval>

Regards,

Wojtek

Message was edited by: Wojciech Gasiorowski

Former Member
0 Kudos

Wojtek,

Many thanks....

But still there is error

Sorry I gave the <val1> node as input instead of <type> hence the err!!

Now the mapping is done exactly as you said...

The problem is I am getting <access> node as many times as <type> node but again <tval> is produced for the first <access> node....

Pls throw some light on this...

Thanks a ton,

Jai Shankar.

Message was edited by: Jai Shankar

moorthy
Active Contributor
0 Kudos

Hi,

Did you change the context to root level ? I think that may be a problem in your case.. try out these .. Also some builtin functions like SplitByValue, RemoveContext may help you to figureout this.

So best way to debug this is to go with Context Queues in the mapping editors. To help in debug-

/people/venkat.donela/blog/2005/06/09/introduction-to-queues-in-message-mapping

Regards,

Moorthy

Former Member
0 Kudos

Hi Krishna,

>>>Did you change the context to root level ?

Pls let me know for which node I need to change the context???

Thanks & Regards,

Jai Shankar.

Former Member
0 Kudos

Hi,

In my opinion you shouldn't change the context of element <val1>. Are you mapping it directly into <tval>?

Could you provide some sample document. Maybe you have only one <val1> inside it.

Regards,

Wojtek

Former Member
0 Kudos

Hi All,

Thanks a lot for the helping hnads.... Yes the issue got resolved when I cahnged the context of <val1> node to <type>. Earlier it was <root>. Thanks again....

P.S: Guys there is another question that is a follow up of the same knd of issue...

Regards,

Jai Shankar.

Message was edited by: Jai Shankar

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

In mapping of val1. Please do it directly without if without else (val1->tval). It should work.

Regards,

Wojtek

Former Member
0 Kudos

Dear Wojtek,

Thanks for the reply. But in my scenario, if condition is essential. I cant avoid this..... Can you pls throw some light on this???

Thanks & Regards,

Jai Shankar.

Former Member
0 Kudos

Hi,

tval is inside some node which is created only based on some condition. So if condition is not fullfilled you won't have tval inside(because this mapping won't be even touched). If condition is fullfilled you will have correct number of tval.

By the way put this "if" condition on your top access element.

Maybe you will have to use useOneAsMany for the output of the comparision with constant.

Regards,

Wojtek

Message was edited by: Wojciech Gasiorowski

Former Member
0 Kudos

Wojtek,

Can you pls explain your point with ref to my scenario??

>>>>By the way put this "if" condition on your top access element.

Maybe you will have to use useOneAsMany for the output of the comparision with constant.

I dint get what you mean by top access element and where to use useOneAsMany???

Pls explain it with ref to our scenario...

Thanks & Regards,

Jai Shankar.