on 05-21-2009 12:54 PM
Hi All,
I have a requirement like...my incoming file(single file) needs to be split into N files based on a number of rows matches to each other. (Rows are matched up on 5 fields)
my incoming file is like this .....
A,name,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
A,name,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
B,name,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
B,name8,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
I need to split this file and my ouput file should be like this
One File:
A,name,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
A,name,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
Second File:
B,name,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
Thrid File:
B,name8,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
Can anyone tell me how this can be achieved?
Thanks,
Rajeev.
Hi,
You can able to do this using message split concept.
Mapping:
Concat the five fieldsremovecontextSplitbyvalue(valuechange)--TargetNode.
In message mapping go to messages tag and change the occourance to 0-unbounded.
In the interface mapping also target message occourance to 0-unbounded.
In ID:
use enhanced interface determination.
Regards,
Prakasu.M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi prakasu,
I tried wiht your mapping suggestions but it doesnt work.
Example:
Name age gender Place
A 20 M HYD
B 20 F BOM
A 20 M BLR
key fileds are name and gender:
I did how you mentioned and the output in MM and IM test tab is as follow:
A 20 M HYDwhere I should get
One messge:
A 20 M HYD
A 20 M BLR
and second one as
B 20 F BOM
Do let me know where I am missing:
Thnaks
Rajeev
Hi,
It should work...can you give your source and target examble structure with sample data..
As you mentioned,
name and gender is key fields.
Map like below:
name---concat--Remove context--sort(Lexicographical(case insensitive),ascending)--
------------------------------------------------------Collapsecontext---------------Node.
Gender--
name---concat--Remove context--sort(Lexicographical(case insensitive),ascending)--Node1.
Gender--
name---concat--Remove context--sortbykey(Lexicographical(case insensitive),ascending)---
-----------------------------------------SplibyValue(Each)-----------------------------------------------TargetElement.
Gender--
Source field(Each field)---------------
You should use Sort by key for all the fields.
Above answer was the below sample structure,
<Target>
<Node>----
0-unbounded
<Node1>----
0-unbounded
<TargetElement1(name)>
<TargetElement(age)>
<TargetElement1(location)>
Regards,
Prakasu.M
Edited by: prakasu on May 21, 2009 6:51 PM
Edited by: prakasu on May 21, 2009 7:01 PM
Hi,
I have the following structure in the MM :
Messages 1..1
--- Messages1 1..1
-
MM_Test 0..Unbounded
-
Age 0..Unbounded
-
Gender 0..Unbounded
-
Name 0..Unbounded
Target structure is:
Messages 1..1
--- Messages1 1..1
-
MM_Test 0..Unbounded
-
Age 0..Unbounded
-
Gender 0..Unbounded
-
Name 0..Unbounded
As I understood from you the did the following mapping:
Message(Target)
Name -
>
Gender-----> Contact -
>Remove Context -> Sort>CollapseContexts>Message(Target)
Message1(Target)
Name -
>
Gender-----> Contact -
>Remove Context -> Sort-->Message1(Target)
MM_Test
MM_Test------>MM_Test
Age (Target)
Name -
>
Gender-----> Contact -
>Remove Context --->
Age -
> SortByKey--
Gender(Taget)
Name -
>
Gender-----> Contact -
>Remove Context --->
Gender--
Name(Target)
Name -
>
Gender-----> Contact -
>Remove Context --->
Name--
Still I am unable to achieve what I need.
Example Data:
Name age gender Place
A 20 M HYD
B 20 F BOM
A 20 M BLR
key fileds are name and gender:
I did how you mentioned and the output in MM and IM test tab is as follow:
A 20 M HYD where I should get
One messge:
A 20 M HYD
A 20 M BLR
and second one as
B 20 F BOM
Thanks
Rajeev
Edited by: rajeev raj on May 21, 2009 4:05 PM
Hi,
No..Not like dat.You should have a structure like below.No need to map message and message1.
MM_Test 0..Unbounded
Details 0..Unbounded
Age 0..1
Gender 0..1
Name 0..1
Instead of mapping Message(Target) you need to map MM_Test and instead of Message1(Target) you need to map Details.
Map like below for the fields:
Age (Target)
Name -
>
Gender-----> Contact -
>Remove Context --->
Age -
>Remove Context > SortByKey
Gender(Taget)
Name -
>
Gender-----> Contact -
>Remove Context --->
Gender--
Name(Target)
Name -
>
Gender-----> Contact -
>Remove Context --->
Name--
Regards,
Prakasu.M
One more way you can try is get the entire file as xml using standard File Content Conversion.
records 0....unbounded
name1 0..1
name2 0..1
........
.........
And then take this payload into a java mapping and split it within the mapping,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Could you please let us know the unique key to differentiate the records.
Thanks,
Kiran.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Kiran,
For example lets have the first two colum are the key fields.
my incoming file is like this .....
A,name,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
A,name,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
B,name,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
B,name8,name2,name3,name4,name5,name6,name7,.....,.....,........,.....,.....
Thanks
Rajeev.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
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.