on 12-28-2009 2:35 PM
Hi Guys,
A simple question on my behalf, but one that has got me stuck.
In my source structure I have this
<root>
<context1>data</context1>
<context2>data</context2>
<context3>data</context3>
<context4>data</context4>
</root>
What I am trying to do is this:
For each of the first 3 contexts, I need a to transform context4. In my target structure I need this:
<context1> and <context4>
<context2> and <context4>
<context3> and <context4>
Can anyone point me in the right direction with this? I cannot get <context4> to map each time, it only maps with the <context1> and then it does not map with the other contexts.
Can anyone help?
Thanks!
it only maps with the <context1> and then it does not map with the other contexts.
You can either raise the context of your relevant source nodes or use RemoveContext function....either of these two will ensure that the mapping logic scans all the source nodes and gives you the desired output.
Regards,
Abhishek.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> What I am trying to do is this:
> For each of the first 3 contexts, I need a to transform context4. In my target structure I need this:
> <context1> and <context4>
> <context2> and <context4>
> <context3> and <context4>
>
Can you describe the above thing in more technical way. I mean how exactly your target data will look like. For Ex.
Let's say your source data is
=======
data1
=======
data2
=======
data3
=======
data4
=======
Now are you looking for a result something like this...
==============
data1 + data4
==============
data2 + data4
==============
data3 + data4
==============
If YES, then simply concatenate "data4" with each data... Otherwise let us know what exaclty you are looking for.. Also let us know the occurrence of source & target data.
Regards,
Sarvesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am not trying to concatenate them into one target field. What I have in the target structure is a context that requires data from both context1 and context4, and then the next record; context2 and context4.
The data from context 4 is just repeated in the target structure, but the data from the first 3 context is different.
Does this make more sense?
D
If I understand you correctly, then no.
I figure now is the time to explain all the details!
Source structure can have n amount of contexts( eg 1 - 3). Also, per source message, there is also 1 other context. (eg 4). In my target structure I have to map each 'n' context to 'n' target contexts. But in the target structure, the context needs data from the first 'n' context as well as data from the single non changing context.
So once again
Source structure:
<root>
<context 1>data1</context1>
<context2>data2</context2>
<context3>data3</context3>
<context4>data4</context4>
</root>
Target structure:
<root>
<context1>
<field 1>data1</field1>
<field2>data4</field2>
</context1>
<context2>
<field 1>data2</field1>
<field2>data4</field2>
</context2>
<context3>
<field 1>data3</field1>
<field2>data4</field2>
</context3>
I trust this makes more sense now : )
D
Create your target structure as shown below.
Target structure:
<root>
<context> 0...unbounded
<field>data1</field>
<cons_field>data4</cons_field>
</context>
</root>
Now do your mapping like this..
Source field -
> Target field (here you can have n number of fields e.g field1, field2, field3... etc)
Source cons_field --->CopyValue -
> Trarget cons_field
You may have to use SplitByValue or need to set the context accordingly.
Regards,
Sarvesh
Hi Daniel,
I feel you have two take care of two things in your target structure.
1.How to generate desired number Context segment at target side
2. How to populate the two fields in your target side.( For field solution suggested by sarvesh will work)
As what I see if you have n number of context at your source then you have to generate n-1 context at your target excluding the last one carrying the constant field which you have to add at every context of your target.
So first achieve the Context creation requirement . I think you have to write custom UDF for this .
However kindly update us if the solution suggested by Sarvesh has already solved your problem then its okay:)
regards,
Saurabh
Hi Daniel,
Try using the function CopyValue, with that function you can specify to use a value from a determined position.
Regards,
Juan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.