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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using tSendMail with tJavaRow

Dears,

I am trying to get data from MySQL and eventually send it as html email messsage.

I read many articles here but dont understand issue with my flow. 

I am getting results, but email content dont show "FirstName" while email sending is fine.

In context option i added one string as "Fname" and in my table i have one "FirstName" column.

in tJavaRow components i added this code : 

context.FName= input_row.FirstName;

And then in tSendMail message added : 

context.FName

0683p000009Lwpb.jpg

 

Please advise what i am doing wrong. Thanks

Labels (3)
16 Replies
Anonymous
Not applicable
Author

1. I saw in another post context variable so i am using them not specific reason.

2. I used System.out.printf and in java debug i can see that everything is printing, msg variable have complete html, though table output is the number of rows, like printing multiple times, but this can be controlled.

3. Now the main issue is null in email, below are my mail settings.

0683p000009Lwqa.jpg

 

In Advance settings selected Html as MIME, and encoding is ISO-----.

TRF
Champion II
Champion II

Did you hange anything in your initial job design?

Else, add a tJava component with the following code before your tSendMail:

System.out.println(((String)globalMap.get("mailMsg")));

If it print something, everything is OK, you have the mail content you want.

Anonymous
Not applicable
Author

Dear TRF,

 

Sorry couldnt get "Did you hange anything in your initial job design?". But results of data are ok.

i added tJava as you suggested and getting null again. Please check below screenshot.

Is it possible it have anything to do with this "onSubJobOk"?

0683p000009Lwc9.jpg

 

Anonymous
Not applicable
Author

Update:

in tJavaRow i added System.out.println(msg); then output is as below.

0683p000009LwsV.jpg0683p000009Lwhs.jpg

TRF
Champion II
Champion II

Here is my tJavaRow (with correction on html syntax):

 

String msg = ((String)globalMap.getOrDefault("mailMsg", "<table><tr><th>ID</th><th>FirstName</th><th>LastName</th></tr>"));
msg = msg +
"<tr>" +
"<td>" + input_row.Id + "</td>" +
"<td>" + input_row.FirstName + "</td>" +
"<td>" + input_row.LastName + "</td>" +
"</tr>";

globalMap.put("mailMsg", msg);

and here is what tJava print on the console:

 

 

[statistics] connecting to socket on port 3767
[statistics] connected
.--+---------+--------.
| tLogRow_40 |
|=-+---------+-------=|
|Id|FirstName|LastName|
|=-+---------+-------=|
|1 |AAA |BBB |
|2 |ABC |DEF |
|3 |DEF |GHI |
'--+---------+--------'

<table><tr><th>ID</th><th>FirstName</th><th>LastName</th></tr><tr><td>1</td><td>AAA</td><td>BBB</td></tr><tr><td>2</td><td>ABC</td><td>DEF</td></tr><tr><td>3</td><td>DEF</td><td>GHI</td></tr>
[statistics] disconnected

Do you have synchrnized your tJavaRow schema?

 

If not, do it and retry.

Anonymous
Not applicable
Author

Yes, finally its working. Thank You 0683p000009MACn.png

Still not sure what the issue was, My schema was sync, maybe html, but good that its working, i got email with proper table now. now i just need to modify html. 

TRF
Champion II
Champion II

Great!