on 03-20-2006 10:43 AM
Hi
I have a problem regarding a mapping.
On the sender side I have a structure that occurs n times. In each structure there is a element which is always equal.
I need to map the value of this element into one specific element on the receiver side.
A direct mapping is not possible as this would cause a n:1 relationship. Now I am looking for a possibility to map for example only the element of the first occurrence of the structure to the element on the receiving side.
I know that something like this is possible in XSLT, however I have to solve the problem without coding.
Does anybody got an idea or a hint?
Thx,
Nana
Subject: Re: Setting element equal to 1st element of n times occuring structure
Ok, maybe I need to be more specific here
The structure actually looks like this
InputStructure:
<Root>(Occurrence 1..1)
---<elementZ>(Occurrence 1..unbounded)<elementZ>
-
<elementX>(Occurs 1..1)<elementX>
OutputStrucure:
<Root>(Occurrence 1..1)
---<ID>(1..1)<ID>
---<elementZ>(Occurrence 1..unbounded)<elementZ>
-
<elementX>(Occurs 1..1)<elementX>)
<elementX> is equal in every instance of <elementZ>.
Now I need to make a content based routing and need the value of <elementX> mapped on <ID> so that I can redirect the whole message according to <ID>.
All this should, if possible occur without writing any code -> use of graphical mapping only.
Anybody got an idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As the value of elementX is same in every occurance of elementZ you can try the following:
elementX(with context as Root)>CollapseContext>ID
Example:
Input:
<Root>
---<elementZ>
-
<elementX>5<elementX>
---<elementZ>
---<elementZ>
-
<elementX>5<elementX>
---<elementZ>
---<elementZ>
-
<elementX>5<elementX>
---<elementZ>
---<elementZ>
-
<elementX>5<elementX>
---<elementZ>
</Root>
Output:
<Root>
<ID>5<ID>
---<elementZ>
-
<elementX>5<elementX>
---<elementZ>
---<elementZ>
-
<elementX>5<elementX>
---<elementZ>
---<elementZ>
-
<elementX>5<elementX>
---<elementZ>
---<elementZ>
-
<elementX>5<elementX>
---<elementZ>
</Root>
Regards,
KNS Kumar.
Hi Nana,
If you need to copy a specific occurrence in your list of values you may use a combination of
- removeContexts - copyValue -
You have to set which occurrence should be copied as a property in the copyValue function.
<u>But:</u> Content based routing is executed before the mapping step! So the structure you create inside your mapping is not available for content based routing.
Best regards
Joachim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I Preassume your scenario is some thing like this.
InputStructure:
<Root>(Occurance 1..1)
---<element>(Occurance 1..unbounded)
OutputStrucure:
<Root>(Occurance 1..1)
---<element>(Occurance 1..1)
Is it is the first element then you can directly map root > and emenet>element . As the occurance of the Target element is 1..1 only the first occurance of source is taken and rest of the n-1 occurance of element are ignored.
Where as if you want say 5th occurance of element, then you have do as below
element>index\
-
|stringequals----|if..\
-
constant(5)-/
.........................element---|then/|>removecontext-->element
Regards,
KNS Kumar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I couldn't get your question clearly. May be give sample source and target structures for better understanding.
Am assuming you need to map the following structure
a n..n
to
b 1..1
For this requirement you dont need to use XSLT mapping, just a small User defined function will suffice.
Give the structure that occurs n times as input. write this small user defined function. Use queue while creating user defined function.
int i;
int flag=0;
for(i=0;i<a.length;i++)
{
if(flag == 0)
{
result.addValue(a<i>);
flag=1;
}
}
And give the output of this function to the target structure.
Hope this helps.
regards,
P.Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can use User Defined Function in message mapping, I think that will solve your problem.
Thanks,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nana,
what means "I have to solve the problem without coding"?
Is it required only to use message mapping?
Regards,
Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.