You are not logged in.
Announcement
Unanswered posts
|
Pages: 1
I am using tFor component to execute a tMysqlInput query n times. and then using a tDenormalize component before oupting to a file.
No matter how many times I iterate using tFor, only the last batch of rows gets sent to output file. To explain in detail, in tFor I have from=0,to=100,and step=20. In the tMysqlInput the sql is "select id,name,ssn,addr1,addr2 from emp limit "+(Integer)globalMap.get(tFor_CURRENT_ITERATION)+"20";
The out put file should contain 50 rows, instead it has 10 rows. These 10 rows belong to the last iteration. So the sql with limit 100,20's results gets pumped to output file.
Is there any thing I can do to over come this prob.
Note: I tested by putting tLog beofore and after tDenormalize to see what goes in and out.
Offline
Hello
There is a 'Append' option on the basic setting panel of output component, if you don't select this option, the last iteration data will cover the previous data. or, you can use tUnite component between tMysqlInput and tDenormalize to merge all the data.
Best regards
shong
Online

Hello,
tMysqlInput the sql is "select id,name,ssn,addr1,addr2 from emp limit "+(Integer)globalMap.get(tFor_CURRENT_ITERATION)+"20";
Are you not missing a comma in +",20" ?
Offline
I think I found the source of problem. It looks like a bug, if some one would confirm, that would be great.
Here is what the generated Java code looks like(I am pasting only those lines that matter w.r.t to the current context):
public void tFor_1Process() throws TalendException {
try {
globalMap.put("tFor_1_CURRENT_ITERATION", 0);
while (((Integer) globalMap.get("tFor_1_CURRENT_ITERATION")) <= 100) { //The iteratiion for iFor component. This is where all the logic for a given iteration resides.
globalMap.put("tFor_1_CURRENT_ITERATION", ((Integer) globalMap.get("tFor_1_CURRENT_ITERATION")) + 20);
}
tDenormalize_1_DenormalizeInProcess();//This should be within the above for loop, but is outside the loop.
} catch (Exception e) {
throw new TalendException(this, e, currentComponent);
}
}
//The actual code should be as follows:
public void tFor_1Process() throws TalendException {
try {
globalMap.put("tFor_1_CURRENT_ITERATION", 0);
while (((Integer) globalMap.get("tFor_1_CURRENT_ITERATION")) <= 100) { //The iteratiion for iFor component. This is where all the logic for a given iteration resides.
tDenormalize_1_DenormalizeInProcess();//This should be within the above for loop, but is outside the loop.
globalMap.put("tFor_1_CURRENT_ITERATION", ((Integer) globalMap.get("tFor_1_CURRENT_ITERATION")) + 20);
}
} catch (Exception e) {
throw new TalendException(this, e, currentComponent);
}
}
Please let me know if I am doing something wrong.
Offline
Pages: 1