One Star

[resolved] need to send the data of tLogRow to tSendMail.

Hi Team,
I have a job which reads the data from *.CSV and details are as follows,
tFileList  --> tFileInputDelemiter --> tmap --> tLogRow -->tSendMail
Here tfileList reads all CSV files and gives the data to tLogRow.
Here I am able to print tLogRow in console, but I want the data which is available in tLogRow to be sent as an email, How to do that?
Note: .CSV files are of same types
23 REPLIES
Moderator

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi,
How about saving data into output file(tfileouputdelimited) then uploading the attchement(output file) into tsendmail?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi Sabrina,
Thanks for your quick reply,
That is one option, but I want the data to be in message body.
How can we do this.
Thanks & Regards,
Rajendra Lella.
Moderator

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi,
You can use tJavaRow  to save each value to a variable then get them in tsendmail message body.
Please see my screenshots for detail.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi Sabrina,
Thanks for your reply,
please could you help us in sharing the job format..
Ex:
tFileList  --> tFileInputDelemiter --> tmap --> tLogRow -->tSendMail
Where can I fit the tFixedFlowInput in the above flow..?
Regards,
Rajendra.
One Star

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi Sabrina,
Thanks for your reply,
please could you help us in sharing the job format..
Ex:
tFileList  --> tFileInputDelemiter --> tmap --> tLogRow -->tSendMail
Where can I fit the tFixedFlowInput in the above flow..?
Regards,
Rajendra.

I don't think that you need tFixedFlowInput
Just put tJava after tmap
Five Stars

Re: [resolved] need to send the data of tLogRow to tSendMail.

design your job like below. 
tFileList  --> tFileInputDelemiter --> tmap --> tLogRow --main-->tFileOutputDelemited.
|
|
OnSubJob OK
|
tSendMail

Created Delimited file using above design then attached same file using tSendMail. 
When you processed all the files then you want to send the mail then above approach is ideal. if you want to send each file process then need to twist the job design 
One Star

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi Umesh,
Thanks for your reply, I want the data to be displayed in e-mail message body, please could you help me in this regards?
Thanks & Regards,
Rajendra Lella.
Five Stars

Re: [resolved] need to send the data of tLogRow to tSendMail.

Ok then just do the job like this. 
Created variable named with mailData string ""
then design job like below. 
tFileList  --> tFileInputDelemiter --> tmap --> tLogRow --main-->tJavaRow
|
|
OnSubJob OK
|
tSendMail

add below code in tJavaRow. 
context.MailData=context.MailData+inputrow.yourcolumn(s);
Add this variable in tSendMail body part.  Not Tested but you can try.
Seventeen Stars

Re: [resolved] need to send the data of tLogRow to tSendMail.

hi,
try simply 


but be aware that for each row a mail will be send  ....
regards
laurent
One Star

Re: [resolved] need to send the data of tLogRow to tSendMail.

just put tJava after tMap lol Smiley Very Happy
Seventeen Stars

Re: [resolved] need to send the data of tLogRow to tSendMail.

hmmm .. tJava do not manage flow. I guess you've only got null value !
One Star

Re: [resolved] need to send the data of tLogRow to tSendMail.

Yea but you write the result into a context variable as xdsho told

tJava to write into a context variable (you dont need <tr> and <td>)

tSendMail using the context variable

Output email : 
Seventeen Stars

Re: [resolved] need to send the data of tLogRow to tSendMail.

you're right  & efficient presentation of data in tsendMail but RajendraLella seems to catch the data from flow not the logs.
on the other hand, but it's a very personel feeling, I don't like to use context to store value that don't change due to differents environment .. prefer the globalMap ... but it's just a point of view & I know a lot use context to re-use data later Smiley Happy
One Star

Re: [resolved] need to send the data of tLogRow to tSendMail.

for the data flow  you can use row1.name like you did on your screenshoot (it works)!
(but use tJavarow not tJava)

stop me if i'm wrong, i'm noob Smiley Surprised
Moderator

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi,
 Please take a look at a KB article about: TalendHelpCenter:What is the difference between tJava, tJavaRow and tJavaFlex?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi,
I am using the below flow for sending a single mail to the recipient about all the information in the tfileoutputdelimited.
tfileoutputdelimited contains no of rows of information which has to be sent as an email.
tfileList-->tfileinputdelimited-->tfileoutputdelimited-->tjavarow-->tsendmail
At the end of this job, i was able to put information in the email, but it sends several emails.
My file generated by tFileOutputDelimited in the above job contains all the information i need to put in the final mail.
Can you help me in this.
Thanks,
Rajendra
Moderator

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi Rajendra,
Could you please show us your job design screenshot?Did you use "Iterate" or "OnSubJobOk" between tjavarow and tsendmail?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi,
I am not able to connect using "OnSubjobOk" ot iterate.
PFA the screenshot                                                 
Moderator

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi,
I am not able to connect using "OnSubjobOk" ot iterate.

That's the reason why you got several emails.
Please take a look a related forum:http://www.talendforge.org/forum/viewtopic.php?id=36026
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] need to send the data of tLogRow to tSendMail.

 Hi,
Can you suggest me to which one should i connect tsendmail through OnSubJobOk.
because when i am trying to connect to tfileList i am and checking i getting an compliation errors.

Thanks,
Tulasi
                                                                                                                                                   
Moderator

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi Tulasi,

What's your java code in tJavaRow? Did you pass input row to Context value? The job design is OK. Something wrong with your configuration. 

Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] need to send the data of tLogRow to tSendMail.

HI Sabarina,
I have used the below code in tjavarow.

Thanks,
Tulasi
Moderator

Re: [resolved] need to send the data of tLogRow to tSendMail.

Hi Tulasi,
I have replied your another topic: http://www.talendforge.org/forum/viewtopic.php?id=40323. Could you please take a look at it.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.