on 04-13-2011 9:00 AM
Hi,
I am working on a file to idoc scenaro. I need to create a new idoc for every 2 records . We have edited the idoc to change the occurence. then wrote a UDF
var1 is the value of source element , and var2 is count
int counter = var2.length;
if(counter == 2)
for(int i =0; i<counter ;i++)
{
result.addValue(var1<i>);
if (((i+1) % 2) == 0 && i<(counter -1))
result.addContextChange();
}
I am getting the context change and new values in the queue for the node of the idoc. But, the node is not getting created for the same.
Can somebody help please.
Thanks,
Reyaz
Hello,
I am getting the context change and new values in the queue for the node of the idoc. But, the node is not getting created for the same.
The occurrence of your root target node is 0..unbounded, therefore it will only take the values of the queue before the first context change. As a result, it is not creating the nodes after the first CC. Do what Sarvesh suggested and it will work.
Hope this helps,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sarvesh/Mark,
My requirement is,
I have source file with n records. I need to create idoc for every 2 records in the source file. For 100 recs in i need 50 idocs to be generated.
As of now, while testing using above UDF, I am getting 2 idocs created for 4 recs in the file. it is creating only 2 idocs for more than 4 records in the file also. But, in queue I am getting all the source values with context change for every 2 records.
PLease suggest some solution .
Thanks®rds,
Reyaz
You don't need below code at all.. while creating n number of idocs context changes is not required. Try without context change and it should work.
if (((i+1) % 2) == 0 && i<(counter -1))
result.addContextChange();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.