Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
JavierP2
Contributor
Contributor

Send tLogrow output to tsendemail

Hi community,

 

I'm working on a simple program, but as i'm quite new not sure how to continue.

 

The program have to do the following:

 

1) Connect to a SFTP server (ok)

2) List the files into a SFTP folder (ok)

3) Move the files into a computer folder (ok)

4) Send a mail confirming whose files have been moved (I think need to send by email the tLogRow output?)

5) If there's no files on the SFTP folder I also want to receive a different mail saying that there was no files into the SFTP. (no idea how to do it)

 

0683p000009M9Vo.png

 

The tSendMail is well configured as I've managed to receive test emails. Can you please help me with  points 4 and 5?  I think it's something to write into the tSendMail..

 

Thanks a lot

Labels (2)
6 Replies
Anonymous
Not applicable

use runIf to trigger the tSendMail components, there is a global variable defined on tFTPFileList that counts the total number of file found, you can use it as the condition of runIf connector, eg:
tFTPFilelist--babababa
-runIf1--tSendmail1
-runIf2-tSendmail2

set the condition of runIf1 as:
((Integer)globalMap.get("tFTPFileList_1_NB_FILE"))>0
// it will send emails if there are at least one file are found and processed.
set the condition of runIf2 as:
((Integer)globalMap.get("tFTPFileList_1_NB_FILE"))==0

// it will send another email if there is no files are found.

Regards
Shong
JavierP2
Contributor
Contributor
Author

Hi! 

 

It worked like a charm, thanks a lot!

 

Have other question, not sure if needed to open other post.. it's possible to add the tLogRow output to the email?  just to know name of files that been procesed.

 

Thanks again

Anonymous
Not applicable

Hi
You can append the data to a context variable on tJavaFlex for used later on tSendMail, eg:
tFtpFileList--.....bababa---tJavaFlex....

In the main part of tJavaFlex:
if(context.filename.equals("")){
context.filename=row1.filename;
}else{
context.filename=context.filename+"\r\n"+row1.filename;
}

on the message field of tSendmail, you can use the context variable like:
"The file names are: \r\n"+context.filename

Regards
Shong
JavierP2
Contributor
Contributor
Author

Hi Shong, thanks for the answer.

 

I canno't make it work.

 

I've added a tJavaFlex (after the if condition) with your code but I think it doesn't know what's filename. 

 

Also, how can I link the tJavaFlex with the email? with a main?

 

Thanks a lot 0683p000009MACn.png

 

 

 

0683p000009M9X6.png0683p000009M9Pm.png

Anonymous
Not applicable

Hi
Don't need to link tJavaFlex to tSendMail, just add a tJavaFlex component, and link tLogRow to it. tSendMail components are triggered by RunIf connector as you did.

Regards
Shong
JavierP2
Contributor
Contributor
Author

It worked! thanks a lot.

 

Last question (not sure if possible to do it), I also want to once done, move again the files to another folder 'historic' and add an OK at the end of the filename so.

 

1111.xml to other FTP folder but with OK_1111.xml name. 

 

I have the procedure done with a tFTPput but I don't know how to pass the filename into the "Newname" variable. If I put "" it keeps the name but cannot add the OK_ at the beggining.

 

I've also tried in tFTPput Newname  "OK_"+ context.filename but it doenst work.

 

Thanks a lot!!