Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to get file name from tfilelist

How to get file names, size, row count and send it to email by using Java components or can we achieve without java components

Labels (3)
22 Replies
Anonymous
Not applicable
Author

You can use the tFileProperties for everything but number of rows. For number of rows you will need to read the files and count them.

Anonymous
Not applicable
Author

Actually my requirement is I have some set of different files in one (reject files)folder. I have to sent an email like filename, filesize and no.of records in file. Can you help me with this requirement.

vaibs_parab
Contributor II
Contributor II

Use 'tFileProperties' component to get the file name, size, permission, etc.

 

And to get the number of rows from file use 'tFileRowCount' component and link this using onSubJobOk to tJava/ tJavaRowcomponent. In tJava/ tJavaRow component use below expression to get the row count and store it into a context variable.

context.FILES_RECORDS = ((Integer)globalMap.get("tFileRowCount_1_COUNT"));
Anonymous
Not applicable
Author

How to dispaly the properties from tfileproperties.

vaibs_parab
Contributor II
Contributor II

Here I'm trying to replicate the solutions. Below is the screenshot of the Job Design.0683p000009LxCG.jpg

 

At tFileRowCount:

0683p000009LxCL.jpg

 

 

 

 

 

 

 

At tJava_2: 0683p000009LwcE.jpg

 

At tFileProperties:

0683p000009Lwpk.jpg

 

At tJavaRow:

0683p000009LwUC.jpg

 

At tSendMail:

0683p000009LxCf.jpg

 

Try this and let me know if this will work for you.

Also, Give kudos if this work for you. 0683p000009MA9p.png

Anonymous
Not applicable
Author

It is listing only latest file, but I want all the files.

Anonymous
Not applicable
Author

You can use the method shown, but will have to use some basic Java String manipulation to build up the details you want for each file (the email message) and append to that for each file. You should be able to do that in the tJavaRow quite easily.

Anonymous
Not applicable
Author

I have to list all the file names in single email can you help me with that.

Anonymous
Not applicable
Author

Something like this (you will have to experiment with this and tweak it yourself).....

context.Message = context.Message+"File: "+input_row.basename+"\r\n"+ 
"File Path: "+input_row.abs_path+"\r\n"+
"File Size: "+input_row.size+"\r\n\r\n";

You then just use the context.Message in your send mail component.