cancel
Showing results for 
Search instead for 
Did you mean: 

Graphical mapping: if-then-else problem

Former Member
0 Kudos
930

Hello,

I'm having a problem with the conditional graphical mapping.

Here's a part of my source schema:

...

E1EDP01 (1..n)

    E1EDC01 (0..n)

...

Here's a part of the target schema:

...

POLINEX (1..n)

...

Goal of the mapping:

If the E1EDP01 element has no E1EDC01 subelements, target element POLINEX is created once.

If the E1EDP01 element has 1 or more E1EDC01 subelements, the target element POLINEX is created as many times as there are E1EDC01 subelements for that E1EDP01 element.

So for example:

source:

...

...

would have to result in 4 POLINEX elements in the target message.

I tried the following mapping:

                                                     E1EDC01

E1EDP01 -- exists --\u00A0                        then

                                ___ AND __ if           >----

-

-

-

-

-

-


POLINEX

                                /                       else

E1EDC01 -- exists --/                            

                                                    E1EDP01

If this is not readable, you can find a screenshot of the mapping

<a href="http://www.ict-cs.com/xi/xi-graph-mapping.JPG">here</a>

.

When I map my source example, I only get 3

POLINEX elements in the target.

Any idea what I do wrong or if there's a better graphical mapping that can be used for this ?

Thanks in advance !


Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

You can use the node function "mapWithDefault", what does exactly what you need.

E1EDC01 - mapWithDefault - POLINEX

Regards

Stefan

Former Member
0 Kudos

Stefan,

thanks for the fast reply !

I tried with the "mapWithDefault" node function, but then I only get as many POLINEX target elements as there are E1EDC01 elements.

Maybe I explained it somewhat unclear, but if there is 1 or more E1EDP01 elements         (f)

(no POLINEX target element for (b) + (e), because this element has subelements.

Can this be done ?

Thanks again !

(will reward points !)

stefan_grube
Active Contributor
0 Kudos

That is strange because the mapWithDefault is designed for just doing this.

Maybe you have to check the context of source and target, maybe they do not mach.

Are all <POLINEX> under the same parent node? Then add removeContexts after the mapWithDefault.

Regards

Stefan

Former Member
0 Kudos

Stefan,

thanks again for the reply.

I don't know what I'm doing wrong then with the mapWithDefault, but the E1EDP01 elements without a E1EDC01 subelement don't get mapped to a target POLINEX element.

All POLINEX are under the same parent node.

Could you have a look at my new <a href="http://www.ict-cs.be/xi/xi-graph-mapping2.JPG">screenshot</a>, following your advised mapping ?

Thanks !

stefan_grube
Active Contributor
0 Kudos

The Context of E1EDC01 must not be changes, it is sufficient to change the context of the target with the node function removeContexts.

I see that you have applied valeus to the node E1EDP01. The mapWithDefault cannot take the values from there.

Could you provide a more detailed example, with values?

Regards

Stefan

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Frederik,

below mapping may solve your problem

E1EDC01----


>Then

E1EDC01-->Exists


>IF -
> RemoveContext-->POLINEX

E1EDPO1-->Split by value---->Else

explanation:-

1) take IF Then Else function

2) for If map E1EDC01 and Exists

3) for Then map E1EDC01

4) for Else map E1EDP01 by using Split by value function in between.

5) Map the result to POLINEX.

Please let me know if your problem is not solved

Regards,

Karan.

Former Member
0 Kudos

Hi,

Can't you have the target as:

Node

++Polinex

Things would be easier..

Former Member
0 Kudos

Nair, the POLINEX has a parent element, being "Group". How could that make things easier ?

Karan, thanks for your reply!, but that didn't work. It only maps the E1EDC01 elements, but not the E1EDP01 elements that have no E1EDC01 subelements.

Stefan,

I indeed messed up with the contexts, I changed it and now it works ! (the values were only put in the test message to make it easier to understand which elements were mapped and which weren't in the result).

Thank you for your great help !

(points awarded )

prabhu_s2
Active Contributor
0 Kudos

Understood question wrong. Content Deleted

Message was edited by:

Prabhu S

Message was edited by:

Prabhu S