Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Using what is described in following link:
I am able to send the query results by email but the email is print results column after column and not in row.
By that I mean if my table looks like this:
Name Date
John 05-08-2019
Nas 05-07-2019
The email that I get is this:
Name:
John
Nas
Date:
05-08-2019
05-07-2019
This is what I have in tjavarow:
context.StepName = context.Name+"\n"+input_row.Name;
context.Timestamp = context.Timestamp+"\n"+input_row.Timestamp;
And this is how the email message in tsendMail is composed:
"Name: "+context.StepName+ " Date:" + context.Timestamp+"."
What I would like to see in the result is each row with column header:
Name Date
John 05-08-2019
Nas 05-07-2019
How can I accomplish this?
Thanks
Hi,
Your email component is called after tjavarow data processing using on SubJob Ok.
So the context.StepName is havig data as below
Name: John Nas
since you have given the code as shown below. It means, the data of name will get continously accumulated to the StepName column one after another.
context.StepName = context.Name+"\n"+input_row.Name;
Instead of this, you can do a simple trick.
Assign the initial value of context.Step as shown below.
context.Step="Name"+"\t"+"Date";
Inside tjavarow, add as below.
context.Step= context.Step+"\n"+input_row.Name+"\t"+input_row.Timestamp;
Then, use the context.Step inside your existing tSendmail (which is connected using OnSubJobOk). This should reslve your issue 🙂
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Hi,
Your email component is called after tjavarow data processing using on SubJob Ok.
So the context.StepName is havig data as below
Name: John Nas
since you have given the code as shown below. It means, the data of name will get continously accumulated to the StepName column one after another.
context.StepName = context.Name+"\n"+input_row.Name;
Instead of this, you can do a simple trick.
Assign the initial value of context.Step as shown below.
context.Step="Name"+"\t"+"Date";
Inside tjavarow, add as below.
context.Step= context.Step+"\n"+input_row.Name+"\t"+input_row.Timestamp;
Then, use the context.Step inside your existing tSendmail (which is connected using OnSubJobOk). This should reslve your issue 🙂
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
That worked.
Thanks for your help.
Hi nikhilthampi,
I followed your explanation for that post, but got slighlty differnt results than wanted.
instead of geting all query results in the mail i only get the last row.
I guess tjava overright the context var each time, but dont know how to fix that.
This is the Log before Javarow:
JavaRow:
context.header="player_id"+"\t"+"Alert"+"\t"+"timecreated"; context.output=context.header+"\n"+input_row.player_id+"\t"+input_row.Alert+"\t"+input_row.timecreated;
tSendMail:
context.output
and that is what i get in mail:
only 1 line
this is the full Job: