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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

split list of files stored in variable

Hi


I'm storing all files in a context variable and then passing that variable to tsendmail to get list of files.

But in list I have two types of file, one is "A.xls.b" and second is "A.xls.g"

but when I pass variable in tsendmail, I get output like

Files: A.xls.b, A.xls.g

But I need files like

B Files: A.xls.b
G Files: A.xls.g

Can I get any suggestion ?

Labels (2)
7 Replies
Anonymous
Not applicable
Author

Files: A.xls.b, A.xls.g

Is this a string you write in the message field of tSendMail?
Anonymous
Not applicable
Author

Hi Shong

In message filed of tsendmail I pass only only context variable in which I'm storing list of all files.
https://www.talendforge.org/forum/img/members/155571/mini_blob_20160106-1535.png

After taggregaterow component, In my job am using tjavarow component. In that component I have put up that context variable.

In tfilelist, I have two types of files like I said one type is "A1.xls.b" and second is "A2.xls.g"

I want to send email, list of these files should be appeared in received mail like this

b Files: A1.xls.b
g Files: 2.xls.g

Not Like this:
Files: A2.xls.g, A1.xls.b  (Note: this type of input I'm receiving right now cos I have set up a context variable "Files" with datatype list and value "Files : " in context.)

And In tjavarow, code written is context.Files = context.Files+input_row.ColumnName

But I need out like I said.

Any suggestion ?
Anonymous
Not applicable
Author

Are you wanting to attach the files you have named in your context variable or do you just want to list the filenames as you have shown above? This needs to be clarified. If you want to just list the filenames in the email message, then you will need to prepare the context variable to hold the values already formatted (using carriage returns, etc). If you are wanting to attach the files using the names, then I think you need to rethink your solution a little. 
Anonymous
Not applicable
Author

I just need the name of the files in message with the format I have mentioned.
Anonymous
Not applicable
Author

OK, try something like this.
Edit your context variable to add this ("\r\n") between your filenames. So, as a simple example, if you wanted to manually create a String with the filenames in, you would do it something like below.....

context.Files = "b Files: A1.xls.b" + "\r\n" + "g Files: 2.xls.g" + "\r\n" + "c Files: 3.xls.c";
Anonymous
Not applicable
Author

Hey rhall

context.Files = "b Files: A1.xls.b" + "\r\n" + "g Files: 2.xls.g" + "\r\n" + "c Files: 3.xls.c";


Its a output am receiving through email when I pass parameter in tsendmail. At tjavarow component I have to split I think.
Anonymous
Not applicable
Author

It doesn't matter where you try out the code I have posted, just do it before you try and use the context variable. There is no guarantee it will work, but that is the first thing I would try.