Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to get file names, size, row count and send it to email by using Java components or can we achieve without java components
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.
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.
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"));
How to dispaly the properties from tfileproperties.
Here I'm trying to replicate the solutions. Below is the screenshot of the Job Design.
At tFileRowCount:
At tJava_2:
At tFileProperties:
At tJavaRow:
At tSendMail:
Try this and let me know if this will work for you.
Also, Give kudos if this work for you.
It is listing only latest file, but I want all the files.
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.
I have to list all the file names in single email can you help me with that.
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.