on 01-25-2012 10:51 PM
Hi Gurus,
I have this source structure from a file:
<SEG>
<field1>1</field1>
<field2>abc</field2>
<field3>abc</field3>
</SEG>
<SEG>
<field1>1</field1>
<field2>def</field2>
<field3>def</field3>
</SEG>
<SEG>
<field1>2</field1>
<field2>ghi</field2>
<field3>ghi</field3>
</SEG>
And what I need in my target structure is to create 1 IDoc per same field1 value. In this example, I will beed 2 IDocs, where 1 contains the first 2 <SEG> and the other one the last <SEG>.
Target structure may be like this:
<IDoc>(0..unbounded)
<SEG1>(1..1)
<value1>1</value1>
<anotherSEG1>(0..unbounded)
<value2>abc</value2>
<value3>abc</value3>
</anotherSEG1>
<anotherSEG1>(0..unbounded)
<value2>def</value2>
<value3>def</value3>
<anotherSEG1>
</SEG1>
</IDoc>
<IDoc>(0..unbounded)
<SEG1>(1..1)
<value1>2</value1>
<anotherSEG1>(0..unbounded)
<value2>ghi</value2>
<value3>ghi</value3>
</anotherSEG1>
</SEG1>
</IDoc>
Can this be possible without UDF?
chk this:
field1--remove context--sort---splitby value(value change)---collapse context---idoc
field1--remove context--sort---splitby value(value change)---collapse context--splitby value(each value)---SEG1
field1--remove context--sort---splitby value(value change)---collapse context--splitby value(each value)---value1
field1--remove context--sort---splitby value(value change)-----anotherSEG1
field1--remove context---
--sortby key- ------------------- --formatByexample----splitby value(each value)-----value2
filed2--removecontext--- /
/
field1--remove context--sort---splitby value(value change)-----
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try mapping for SEG1 like below.
SEG--->removecontext--->
------------>formatbyexample---->SEG1
Field1--->removecontext--->sort--->splitbyvalue(valuechange)----->
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Chapa,
yes,
As my friends have suggested you can use the Node Functions without using the UDF.
But the problem is you should be careful of all the target fields as they should also have the same context in which you are generating the Idoc Parent Node.
I have done similar stuff 2 years back.
For the child Nodes of Idoc, if you are able to generate them in context of the Idoc its fine or else you may have to write uDF for these.
Take the Input field A -->Remove Contexts --> Sort > splitByValue(ValueChanged)>Collapsecontext--> Idoc
This will perfectly remove all the duplicated and will generate 1 Idoc per Field A ignoring Duplicates.
But now the other child fields of Idoc they just go to target in Queue.You cannot sort them.
So, Just take care of the context for the child nodes.
Thanks,
VK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Field1->removecontext->sort->splitbyvalue(value change)->collapsecontext--->IDoc.
above logic will genarate multiple idocs if Field1 value changes.
similar way try for another segment too..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chapa,
U can create 2 IDOCs using Graphical Mapping also.
take field1 with context higher lever and use splitbyvalue change then assign to the target IDOC.
Thanks,
Enivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
>>>Can this be possible without UDF?
I don't think so - you need to write a UDF to be able to create correct idocs from correct structures
Regards,
Michal Krawczyk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.