on 12-03-2014 2:49 PM
Hi SDNites,
Need to split file after every 2nd record,
Source File structure,
Header
Item1
Item2
Item3
Item4
Item5
Footer
Expected output,
Receiver File1 :
Header
Item1
Item2
Footer
Receiver File2 :
Header
Item3
Item4
Footer
Receiver File3 :
Header
Item5
Footer
I am able to do the splitting with graphical mapping. But the probelm is Header is not getting to Receiver File 2 and 3. Any suggestions on how to map the Header will be of great help.
Regards,
Abhi
Hi,
I am able to complete the above requirement with graphical mapping.
Thanks a lot to you all for your valuable inputs.
@Hareesh - I have analysed the UDF that you have provided and using it I have identified graphical mapping functions to achieve it.
Regards,
Abhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhishek,
Use Graphical variables and try like as shown below. For understanding purpose, I have grouped all target fields
createContexts UDF Code
for(int i = 0; i < var1.length; i++)
{
if(i%2 == 0 && i != 0)
{
result.addValue("");
}else if(i == 0){
result.addValue("");
}
}
split_Items UDF code
for(int i = 0; i < var1.length; i++)
{
if(i%2 == 0 && i != 0)
{
result.addContextChange();
result.addValue(var1[i]);
}else{
result.addValue(var1[i]);
}
}
Best Rgds,
Praveen Gujjeti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
>>I am able to do the splitting with graphical mapping. But the probelm is Header is not getting to Receiver File 2 and 3
Try using copyvalue (0) function for header and its corresponding fields.
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
Your answer is absolutely correct.
Stuck up further in the same mapping,
1. Message split - Working fine.
2. Same records - Copying fine in each new message.
3. Structure based on which split is happening has to be populated in receiver message. It is getting populated but here all the records are seen in one message and not the split ones.
Ex:
Header
Item1
Item2
Item3
Item4
Item5
Footer
Expected output,
Receiver File1 :
Header (Fine)
Item1 -------------- Here I am getting all the Items (1,2,3,4,5)
Item2
Footer (Fine)
Receiver File2 :
Header (Fine)
Item3 -------------- Here I am getting no records
Item4
Footer (Fine)
Receiver File3 :
Header (Fine)
Item5 -------------- Here I am getting no records
Footer (Fine)
Regards,
Abhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use the function OneAsMany or define a parameter on header level in target where you map the header to. and then use this parameter to map the headerinfo again to every instance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
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.