Qlik Sense allows for interactive analysis of data, but sometimes you just want to send data to users via email. This tutorial describes how you can email a table of data during the load process using Qlik Web Connectors and HTML. It also looks at some of the other things you can do with the free SMTP Connector.
Note that this article was written for Qlik Sense Enterprise Client Managed, and the solution still works on that platform. On Qlik Sense Cloud the syntax is slightly different as you have to use the SMTP connector rather than Qlik Web Connectors. Take a look at this post for details of how to do that.
Why Send Data From The Qlik Load Script
QlikView has a couple of features which are very useful which are not provided with Sense straight out of the box. The first is that the QMC sends email alerts whenever a task fails, and the other is the Alerts functionality. Using the SMTP Connector within Qlik Web Connectors allows you to replicate this functionality and do more besides. This blog post looks at sending data to users from within the load script, I’m looking to write up Task failure notifications in a future blog post. As a reminder of how you can send data from QlikView you may want to see this blog post on Sending Data In QlikView Alerts. The SMTP Connector is one of the Standard (i.e. free) connectors provided with Qlik Web Connectors, for details of these you can see this post on Free Qlik Web Connectors. Note that the SMTP Connector has been renamed from the original name of Notification Connector, which provides a bit more clarity around what it does.
What we are going to look at in this post is pushing a table of aggregated data out to an email address on each refresh of the data.
Solution Approach
Typically in a Sense app you are loading a number of details rows and then building tables and charts which provide aggregated views of the data. Using QlikView Alerts or NPrinting the Qlik engine can be used to build these aggregations for you. As we are going to be sending the data from the load script we need to perform the aggregations ourselves at this point. Both Alerts and NPrinting can also trigger mails based on criteria – whilst this example does not cover this always remember the load script is a full programming language so conditionally calling parts of the code is very simple.
In order to show the aggregated data clearly in an email we are going to be using HTML to build a table, with a touch of CSS to make it look tidy. The SMTP Connector allows you to pass the body of the email in the URL, or to link to a local file with the content. As our table may get quite large we are going to write it to a HTML file on disk and tell the connector to pull that in. The process of creating the file has been covered in this previous post on the Qlik STORE Command, but I will tell you all you need here also.
The SMTP Connector can also mail attachments and link to images (perhaps created on the fly using the Sense API), but I am not covering that in this post.
Before You Start – The Prerequisites
The solution given below assumes that your version of Sense supports the command URL IS. This was brought in in the February 2018 release of Sense. It also refers to the SMTP Connector, which was renamed at some point this year, so a up to date version of QWC is recommended. If you are using QWC without a licence (i.e. only free connectors) then you need to keep within the last couple of versions anyway, so an upgrade is always wise.
Building An App Which Sends Data
Now you are all set here are the steps you need to follow to have email sent to you directly from your Qlik load script. I’ve described connecting to some sample data (from the excellent GapMinder site), but obviously you can plumb in whatever data you like. I’ve uploaded my app to Qlik Community should you want to download it, but you should get a fully working app by following these steps.
Setting Up Libraries
This app requires two libraries to be set up.
Firstly set up a Web library called GenericWeb. This can point to any valid web page, as we will replace the URL later on in code. This is still quite a new feature in Sense, and is well worth knowing how to use to avoid loads of different Web connections.
Next set up a Folder connection called TempData to a temporary store on your Sense server or desktop. I’ve used c:\temp\. You can use a different location, just adapt the code later on. As this location will have a copy of your data in it you will need to ensure it is secure.
Creating Encoding Subroutine
A number of the variables which make up the URL which is passed to Qlik Web Connectors need to be URL Encoded. This means that characters which could be misinterpreted need to be changed to a sequence of characters instead.
Create a sub routine to do this encoding:
sub Encode(vEncodeMe, vEncoded)
let vEncoded = replace(replace(replace(replace(replace(replace(replace(vEncodeMe, ':', '%3a'), '/', '%2f'), '?', '%3f'), '=', '%3d'), '\', '%5c'), '@', '%40'), ' ', '+');
end sub
The first parameter is the value to be encoded, the second parameter is a variable to be populated with the encoded value.
Setting Constants
These three variables store some environmental values. The variable vQwcConnectionName is used when Qlik Web Connectors when it generates Standard Mode code for us, so it is worth using that name. The vConn is just to make our URL shorter later, as we can refer to the variable. Finally vEmailFile defines where our staging file will be written, this must match the folder of the library created earlier.
let vQwcConnectionName = 'lib://GenericWeb';
let vConn = 'https://localhost:5555/data?connectorID=NotificationConnector';
let vEmailFile = 'c:\temp\EMailOutput.html';
The URL of your Qlik Web Connector server may differ, so enter that in here. You may require a machine name or domain reference here, rather than localhost, if your QWC instance is on another machine.
SMTP Settings
Now we define the settings for the SMTP connection. Note that some of these variables use the Encode sub-routine we created, others we don’t need to use it for.
call Encode('notifyme@wherever.com', vMailRecipients);
call Encode('smtp.gmail.com', vSMTP);
let vPassword = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
call Encode('someaddress@gmail.com', vFromEmail);
call Encode('Sending data from Sense Load Script', vSubject);
call Encode(vEmailFile, vEmailContent);
let vUseSSL = 'True';
let vSSLMode = 'Implicit';
let vPort = '465';
The settings above are for a GMail account. You will need to plumb in the correct settings for whichever SMTP server you wish to use. As this process is for sending emails only it is a good idea to set up a new account expressly for this purpose.
The password needs to be encoded before it is entered here. This can be done using the Qlik Web Connectors UI. First go to your QWC page (https://localhost:5555/) and go to the SMTP Connector settings (this is under the Standard connectors). In here you can set up and test your SMTP settings, including entering your password. The code which is generated on successful running will include the encoded version of your password. Extract this from the URL and enter it in the right place, it will appear after Password= and before the next ampersand (&).
Note that whilst the password looks very different it needs to be passed to SMTP as the original string. This means that a two way encoding mechanism is used, so someone who has your encoded password could in theory turn it back to the original one. Hence the advice to set up a new account just for sending.
There is a function in QWC where you can send a plain text password and receive the encoded one back (the Helper connector). This means you can enter the password in plain text in your script. I wouldn’t recommend this approach though.
Note that the Subject is included in these variables. If you want to have a dynamic subject (e.g. with record count) you can move that line to later in your code.
Get Some Data
Here you need to get the source data for whatever table you want to email around. If the application you are creating is purely for sending data you may want to bring in the aggregated data that you wish to send. If you are sending from an app that is also used for analysis you probably want detailed data for that analysis, and the aggregated data can be created in the next step.
This statement uses our generic library and grabs some data.
Population:
CROSSTABLE (Year, Population) LOAD
"Total population" as Country,
[2011.0] as [2011],
[2012.0] as [2012],
[2013.0] as [2013],
[2014.0] as [2014],
[2015.0] as [2015]
FROM [$(vQwcConnectionName)]
(URL IS [https://docs.google.com/spreadsheet/pub?key=phAwcNAVuyj0XOoBL_n5tAQ&output=xlsx], ooxml, embedded labels, table is Data)
;
Aggregate That Data
When you create a table in Qlik Sense you will provide a number of dimensions and then some calculations (Measures). This will then give you one row per distinct combination of dimensions.
We need to create that same table in code. This can be done with a GROUP BY statement, like this.
AnnualData:
LOAD
Year,
num(sum(Population), '#,##0') as [World Population],
num(max(Population), '#,##0') as [Largest Population],
num(avg(Population), '#,##0') as [Country Average]
RESIDENT Population
GROUP BY Year
;
In this instance we are creating one row per Year. Additional dimensions can be added to the load list, each of these also need to be added to the GROUP BY statement, in a comma separated list.
The expressions given in a GROUP BY load are very similar to those used in the expressions in Qlik objects in the front end, but there are some differences. Try the expressions that you would use to see if they work, if not you will need to modify. Probably the most notable difference is that you do not have access to Set Analysis in the load script.
Load Header Information into a Table
We are going to write the contents of a Qlik table to a file to then send as an HTML email. So first we need to put the preamble into the table.
EMailOutput:
LOAD
[<!--EMailOutput-->]
INLINE [
<!--EMailOutput-->
<html>
<head>
<style>
tr:first-child td {font-weight: bold;background-color: #dddddd;}
h3 {Font-family: Arial;Font-size: 12pt;}
td {border-left:1px solid #555555;border-top:1px solid #555555;font-family: Arial;font-size:9pt;text-align:left;padding: 2px 10px 2px 10px;}
table {border-right:1px solid #555555;border-bottom:1px solid #555555;border-collapse:collapse;}
</style>
</head>
<body>
<h3>Population stats for past five years</h3>
<table>
<tr><td>Year</td><td>World Population</td><td>Largest Population</td><td>Country Average</td></tr>
];
Note that the field name will be written to our output file, so it needs to make sense as HTML. This is why I have put a HTML comment there.
A style sheet is given here, which means that the table which is written out with the data in can be much simpler as all styling is handled by the CSS.
Add The Data Table
We have the data we need in a table, we now just need to format it so it displays right in HTML and add it to our table.
CONCATENATE(EMailOutput)
LOAD
'<tr><td>' & Year &
'</td><td>' & replace([World Population], ',', ',') &
'</td><td>' & replace([Largest Population], ',', ',') &
'</td><td>' & replace([Country Average], ',', ',') & '</td></tr>' as [<!--EMailOutput-->]
RESIDENT AnnualData
ORDER BY Year DESC
;
Here we are constructing a number of HTML table cells to properly contain each value in our data. Note that one row of text will be written for each row of the table.
Note that we need to do a replace on the values to URL Encode the commas in the numbers. This is not because the commas will not display correctly in HTML, rather than when the STORE statement is called later it will place double quotes around any values that include commas in them. This will break our HTML. If you don’t use commas as thousand separators then you are good to go without the replaces.
Append On The Footer Information
Just as we started with the header information we now need to concatenate on the footer information.
CONCATENATE(EMailOutput)
LOAD
[<!--EMailOutput-->]
INLINE [
<!--EMailOutput-->
</table>
</body>
</html>
];
You have probably noticed that we are simply building up our code in bite-sized chunks. In the same way we could build in a number of tables and bits of narrative in one email. We are not limited to a single table of data here.
Write The HTML to a Text File
Now we have our table constructed with all of our HTML code we need to write this to a file that the SMTP connector can use. This is simply a case of using the STORE statement that you have probably used for writing QVDs, but here we are saying that we want this written as a text file.
STORE EMailOutput INTO [lib://TempData/EmailOutput.html] (txt);
If your Library was set to point to a web server, perhaps on a UNC path or on the Sense server, then this output can be served up on a web page. This is a great way of outputting data from Sense for a wall board. A very simple Sense extension can be used to make Sense into a web server for this purpose – I will write this up in a future blog post.
For now though we are just using this output in the SMTP Connector.
Send The Email
Finally we just need to send the email. This is done by pulling data from a web page (the same as any other Qlik Web Connector call), the difference is though that this call interacts with a server to send data and not just receive it.
SendEmail:
LOAD
status as SendEmail_status,
result as SendEmail_result,
filesattached as SendEmail_filesattached
FROM [$(vQwcConnectionName)]
(URL IS [$(vConn)&table=SendEmail&SMTPServer=$(vSMTP)&useSSL=$(vUseSSL)&SSLmode=$(vSSLMode)&Port=$(vPort)&Password=$(vPassword)&to=$(vMailRecipients)&subject=$(vSubject)&message=%40file%3d$(vEmailContent)&fromName=Sense&fromEmail=$(vFromEmail)&appID=],
qvx);
Note that we have three fields coming back from the query. These will confirm to us whether the send was successful or not. If you want to bulletproof your code you should use PEEK to look at these values just to check that the process has done what you expect.
You will see in the URL all of the variables that we have set up. Crucially there is the message= parameter, which then is pointed to a file, and the location of the content we have written to disk.
Note that you can generate the bulk of this code using the Qlik Web Connectors UI, but the code here has all the various parts moved out into variables, which makes it easier to configure.
Example Application
If you have followed the instructions above you should now have an application which emails you data on each reload.
In case this hasn’t quite worked out for you, or if you would just like to check your workings, you can download my completed application from Qlik Community. You can find this here:
The application also has a sheet which shows the two sets of data (aggregated and raw), the result from the SMTP send and the HTML generated as a table.
If you have any questions regarding this technique please put them in the comments below, thanks!
Community Update!
Héctor Muñoz has kindly shared this post on his blog, and not only that he has taken it to another level. With the code above it is only possible to send tables of data. What Héctor has done is provided the code needed to get data in the load script, parse it, send it to the Image Charts site to get a chart and then include that in the body of the email. This is awesome and opens up some very interesting possibilities. Many thanks Héctor for doing this.
The blog post has unfortunately now been taken down.
We always welcome people commenting on or expanding the things we do in our posts. Please used the comments field below if you have something you would like to share.
Hi Steve,
Thanks for sharing!
Just for your information, Qlik has a built with an option to bypass proxy settings on the SMTP connector.
Especially handy since you can only run one instance of the web connectors per server and proxy is a global setting. Indeed few connectors do need proxy (Sharepoint 0365, REST), while others don’t (SMTP, SFTP)
The built is not released yet, but available through Qlik support.
Cheers,
Armand
Great to see that Qlik are again adding features to their products. I’ve previous blog posts (see Quick Sense Tables) which they have practically made redundant through new features! Thanks for the heads up on this.
[…] Hello everyone, today with a little hack of the original post by Steve Dark (https://www.quickintelligence.co.uk/send-data-from-qlik-load-script/ ). […]
Hey Steve,
Thanks for the great guide. I’m having a bit of trouble with this one – everything works perfectly, except for the fact that instead of the mail sending the table in the body, it simply sends the file path of the html file in the message body like this : “lib://FilePath/EmailOutput.html”.
Have you any idea what the issue might be?
That sounds like you are missing the %40file%3d from the URL. This denotes that the body of the email should be picked up from a file. It is URL encoding for @file=. Hope that helps.
I added that, but then I get an error saying “The following error occurred:
Internal Server Error” which is not very descriptive.
I did add the encoding and the call to encode in my script.
Very strange.
That error is sent to the client on any failure to obfuscate any sensitive information that may come back from an error message on the connector. If you RDP to the server with QWC and try you may get a more sensible error message. You can also try copying the URL and pasting it into a browser on the QWC server.
The most likely error is that QWC doesn’t have permissions to read the file you are trying to use in the body of the mail. This is both Windows permissions to the file for the QWC service account, and also in the deploy.config file in the QWC folder. In the latter you need to enter the path for the file into the node. Good luck!
In fact, I downloaded your app from the Qlik Forums and I’m getting the same error using your code. Might be a system issue then.
Have you been able to try running from on the server itself, or plumbing in the details into the QWC web config pages (on port 5555)?
Hi Steve, I am still getting error after giving path in deploy.config file. Is it I need to restart the web connector services?
You will certainly need to restart the QWC service to have it re-read the config. You will also need to ensure that the service account that the service is running as has write access to the folder. The format of the entry in deploy.config file is quite specific, if it doesn’t work first time check the documentation and try again.
Hi Steve,
Is it possible to do the reverse?
i.e. use an email to trigger a load.
There are bureaucracy issues with direct access to servers, so an email is issued when the new data has been placed in a certain folder.
Many thanks
Hi Colin,
With the API anything is possible, but can take a bit of scripting. A potentially useful wrapper around the API is corectl (https://github.com/qlik-oss/corectl), this will allow you to call the reload from elsewhere.
You can do most of what you want with Sense out of the box though. The web connectors have an IMAP connector which works in a similar way to the SMTP one. This can check a mailbox for a new request to reload and perform the load if one is there. You will need to have the reload running frequently, but only do the data refresh from source if new data is present, otherwise you will need to load from QVDs stored at the last run as there is no option to do a graceful escape from a reload or to simply not load any data (without breaking your app).
We have a couple of clients where data is sent via email as attachments. Sense then downloads these using QWC and then loads them into the app. This works well.
Hope that makes sense?
Steve
Hi Steve,
Thanks for the prompt reply.
Yes it makes sense, but like many things, will need to practice/fail/try gain to really get to grips with it.
Just one question please, on the point “You will need to have the reload running frequently, but only do the data refresh from source if new data is present”.
Could this be perhaps a daily run that looks for the new email, then if yes, run the App using the data agreed folder (it will always have data present).
I guess a subsequent email could then be sent including the requisite details to the admin team that:
1 – new data has been successfully loaded
2 – a summary of that new data
Many thanks
So, you would have a QVD generator type app, which simply takes data from Source and writes it to QVD files. This can run every 15 minutes, if required, and the first thing it can do is see if there is an new email arrived since last time it ran. An IF statement can then be used to skip the rest of the load if no email is present. This way the load will be super quick if it has nothing new to do. The app that loads from the QVDs will need to load all the data each time it loads, so you may want to consider how frequently that runs – given that most of the time the data will not have changed.
You certainly could fire an email back out again confirming that data has been loaded.
Thanks Steve, appreciated.
Really enjoy the blog.
Hello Steve,
Thank you for the detailed information. I need to send to the customer a daily file with data transformed in QlikSense Business. :
solution 1 => schedule a daily sending from a visualization table (sheet) to the customer email or ftp
solution 2 => schedule a daily sending from the script load to the customer email or ftp.
What do you suggest please knowing that we are using QS Business at the moment. Is a scheduled daily export of data from QS Business is possible?
Kind Regards,
Mohamed.
Hi Mohamed, it should be possible.
It depends a bit on which version of Qlik Sense Business you are on. The old version (QSC4B) has the SMTP connector available, but does not have the ability to store to disk. If you can build the file in script in a variable you can send it in the body of the email. With the new QSB you can now (finally!) store files to disk in the load script, this will allow you to use the store statement to write a file before sending.
Whilst both versions of the paid for Qlik Cloud have the SMTP connector available, they work in a different way to using Qlik Web Connectors, as described in this post. As I generally work with Sense Enterprise I have not had cause to send mail from the Cloud. I therefore don’t know exactly what will work or won’t work, but as the connectors available in the Cloud are based on QWC I would imagine that similar options are available.
Hope that helps!
Steve
Correct. I was on an early beta of QSB and it was a little unpredictable at times. Hopefully it’s sorted now it is commercially available. I’m not sure if you will be able to see your data files folder with the connectors, but hopefully they will have got this working.
Hi Steve,
Thank you for your answer and it helps for sure. I can then investigate further. For information, I have paid version of QSB (the new version). Then according to your feedback this should be possible in two steps:
step 1: store statement to create the file before sending
step 2: using QWC to send the file to ftp or email should be possible.
Did I understand correctly?
Regards,
Mohamed.
Hello Steve,
Thank you for these advises.
Kind Regards,
Mohamed.
Hello Your code works fine, but my email has multi language. and while sending those multi language characters in email, it prints not exactly as the data should be.
May i know a solution for this issue..
Some charterer which is written in japanse but it displays as below
IC液晶表示ã—ãªã„(IC交æ›)
Hi Vimal,
I’ve not had the need to send in Japanese, so have not come across this problem. The two things I can suggest to try is to check the font in the stylesheet of the HTML supports those characters, and check to see if any of the characters need to be added to the Encode subroutine in the load script. The other thing which may be happening is that the text file being written out by the STORE statement is not Unicode, so doesn’t handle all of the characters, look in the .html file to check. You may be able to add a format specifier inside the bracket where the (txt) is to say you need unicode – check help.qlik.com on the STORE statement for more information on this. Good luck, and please post back here with how you get on. Thanks!
Hello Steve,
I tried your solution and it works well! Thanks a lot for sharing this kind of tips!
I need your help about the design sent by mail.
I have some quotations marks in the body and I don’t know where they come from. Also, the design of the header is not applied.
Do you have any ideas about these 2 issues?
Thanks in advance.
Regards,
Pauline
Update: I solved the issue about the quotation marks. It was du to special characters.
Hi Pauline,
There will be a number of factors here. Quotations will appear if you have any commas or quote marks in your HTML. The comma issue can be fixed by setting the delimiter when you export, with the following code on the STORE statement:
STORE EMail INTO [lib://LibName/FileName.htm] (txt, delimiter is ‘¬’);
The quotations I have not found a way around, just remove any double quotes from the code. This can make for invalid HTML, but I’ve found most code works without the quotes there (it just messes with my OCD seeing it being wrong).
The header design missing, is this because of CSS not being applied, or are there embedded images? For the CSS, don’t put it inside head tags, just have it inside the html tag – again, not strictly correct HTML, but it should work.
Good luck getting this right, let me know how you get on.
Steve,
Thank you for your quick answer!
I solved my second issue! The design for the table was well applied (border, etc.) but not for the the header row.
I targeted the tr tag with a class and I replaced ‘tr:first-child td’ by ‘tr.class’. It is working now.
Thanks for your help.
Regards,
Pauline
Hi,
someone has the URL for the REST connection
that I could sent a mail from data load editor?
Hi, you need the free Qlik Web Connectors and the SMTP connector specifically. These can be downloaded from the Qlik download site, if you have any paid for licences. The current release (as at July 2020) can be downloaded by clicking here.
thank you !!
now I have a problem with the varibals to the subject and messege:
“…&subject=$(vsubject)&message=&(vmessage)&html=True&fromName=BI&fromEmail …”
not succses with the varibals, why?
Update : I succseed.
Hi Steve,
Thanks for this post. Really helpful.
I have added the following feature:
I created a custom property on Task, App and Stream level : Alerting
This custom property contains email address to handle and maintain all the email distribution.
So if any of the tasks within a stream fails, it will send a mail based on the CP for example
Hi Martijn,
Sounds like a smart way of expanding the capabilities in Sense. Custom properties in QMC are very useful, and I often use them for security rules. Anything which is not there out-of-the-box in Sense can always be built using the tools which are provided. Thank you for sharing.
Steve
Hi Steve,
I followed your guide and get stuck when loading /sending the mail.
It always says “Connection not found: Generic_Web’
for Generic_Web i tried https://google.com and https://w3schools.com since you said, it is irrelevant.
when i copy and paste the full link from the URL IS [..] statement, the Mail is send correctly.
At the Web connectors page there is a red box explaining: “Within Qlik Sense you need to go to the ‘Create new connection’ -> ‘Web file’ dialog, using URL: ‘http://localhost:5555/’ and give it a name….”
i tried this as my Generic_Web page as well and it worked neither.
Do you have any clues how to get my Connection to be found?
There are a couple of things that could be the issue here. Firstly you can no longer create a web connection to any old site, Qlik changed this as a security precaution. You will need to use http://servername:5555/ where servername points to your Qlik Web Connectors server (quite possibly localhost). When you create the connection it will create with your username in brackets after the connection name. You can either add that into the from statement, or go into the QWC and edit the connection name to remove the suffix (I tend to do this with all connections). Also, be careful with the connection name, like anything in Qlik, capitilisation, spacing and punctuation (underscores) are all critical.
Hope that helps!
Hi Steve, Thanks for reply. in the end it was just a missing underscore. I tought i had edit the name yesterday and i’m very sure that I saw the connection name with an _ yesterday. But when I opened the App today, the underscore was missing in the connection-list.
Could be that i messed up the saving of the connection name, because i used my testing app with the same user on 2 different machines. It is now working, Thanks for the well written guide!
That’s great news, hope you are able to make lots of use of this technique. Thanks for providing the update.
Hi Steve,
Thanks for such a great tutorial! Yet another one!
I have set it all up, however we are limited to where we can store data and we can no access to remote into the servers. So I have stored the html file into the LIB as you did but I cannot use the full file path to load it back in. Any suggestions on how I might be able to still use the file I generated?
Many thanks,
Bruno
Hi,
If you are using Sense Client Managed (on-premise) and Qlik Web Connectors then you will need to find out where the physical path to that library is. The STORE statement can only use a library (unless you put the server in legacy mode) and the Qlik Web Connectors can only use the physical path. If you can edit the connection in Sense you can see where the connection is pointing to, or if you can get to the QMC you can find it there. If you don’t personally have access to that then you will need to contact whoever manages the server. They will probably need to amend the QWC config for you also.
Hope that helps.
Steve
Hi Steve,
Thanks for your prompt reply!
I have managed to find the full path but still doesn’t work, could it be because the path doesn’t start with a letter for the drive it’s in?
Either way, thank you, I’ll get who owns the server to give me the full path and if needed, get them to set up a folder in the same environment where I can store to and use the full path for it to be accessed by the service account.
Thank you very much!
Bruno
The most likely issue is that permission isn’t granted on the folder in QWC deploy.config. Copying the URL that is sent to QWC and pasting it into a browser on the QWC server is the best way of getting debug information. Hope that you get this working soon!
Hi Steve,
Is there any way to send a file as an attachment with the connector (QlikView or Sense)?
Thanks!
Hi. Yes, using Qlik Web Connectors. Attachments are done in almost exactly the same way as using HTML as the body of your email. You ensure that the file you want to attach is in a folder that QWC can see and then add &fileAttachment1=$(vAtt1Enc) to the URL, where vAtt1Enc is an encoded variable giving the path to the file. Hope that gives you what you need to get it working. Give a shout back if not.
Thanks! Will try!
Dear All
Can you Please help me i this
I am trying to get more then one task failure notification but i am getting only one can you pleas help me to get more then one task failure
getting this now
Jaya15_0-1660650007056.png
want to get the 2nd table as well
using below code
Jaya15_1-1660650007058.png
Jaya15_2-1660650007060.png
Please help
Thanks
Jaya Sharma
Hi Jaya,
I saw your post on Qlik Community, here: https://community.qlik.com/t5/New-to-Qlik-Sense/Qlik-Sense-Failed-Task-Email-notification/m-p/1969095#M212098 and will respond on that thread. Thanks.
Hello,
I am getting error as
The following error occurred: This statement only works with lib:// paths in this script mode
I get test mail via web connector. I also tried same URL from the connector but still same error
Hi Shrikant,
It sounds like this problem is due to the fact that the article was written some time ago for QlikView and you are running it in Sense. For Client Managed Sense the approach is very similar, but where you are writing to files with STORE you need to change it to reference a library, which will begin with LIB://. Qlik Web Connectors still refers to the filesystem using local paths (e.g. c:\temp\), but you need to set up a library pointing to the same folder.
Hope that makes sense?
Steve
Thanks Steve, This is a great article and helped a lot.it was a silly mistake (copy paste) instead of // I had put /.
Next question would be is it possible to export a table object data from Qliksense too store data in Excel instead html and send the excel as attachment?
Not in the same way as this. Store will only do CSV/tab delimeted etc. and only from tables in the load script, rather than the front end.
The best way to achieve this will be with Qlik Automations, for which you will need an Enterprise Cloud account to get access to these features. If you have to stay on premise then NPrinting is the way to go.