Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
harsha
Creator
Creator

SMTP /web connector mail notification failed

Hi Team,

I'm trying to load data and generating some flags according to 2 rules. And when the data gets loaded, it should mail the results based on the condition.

I have installed QlikSense SMTP connector and successfully added to my application. Currently, it is sending a mail whenever data gets loaded. However, my requirement is to send mail when a particular rule(s) gets loaded along with the Data.

*******************Data Load*******************

Unqualify *;

[Sheet1]:
LOAD
[CompanyID],
[Year],
[DataPointID],
[Value],
[Flag]
FROM [lib://Automation/Book1.xlsx]
(ooxml, embedded labels, table is Sheet1);

 

*******************//Rule - 1*******************


NoConcatenate

DecimalFlag:

Load *,

if(Frac(Value)>0,'WithDecimal','WithoutDecimal') as Decimal

Resident [Sheet1]

where match (DataPointID,'430');


*******************//Rule - 2*******************


NoConcatenate

Compare:

LOAD CompanyID, [Year], Value As Value1
Resident [Sheet1]
Where DataPointID=431;

Left Join(Compare)
LOAD CompanyID, [Year], Value As Value2
Resident [Sheet1]
Where DataPointID = 432;

Left Join([Sheet1])
LOAD CompanyID, If(Value1<Value2, 'Yes','No') As Compare_Flag
Resident Compare;

Drop Table Compare;

Note: I'm able to load the data and run the rules. I need to send the data to a mail.

My data looks: 

 

Untitled.png

 

 

 

 

 

 

 

I'm able to send a notification but I want to send data once the rules are loaded

Untitled2.png

 

 

 

 

 

 

How do I send a mail once the rules are loaded along with the Data

Labels (7)
1 Solution

Accepted Solutions
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Suggest that you take a look at this blog post, I believe that this has everything that you need:

https://www.quickintelligence.co.uk/send-data-from-qlik-load-script/

To attach the file you will need to write it to a CSV file and then there is an extra parameter.

You will need to store to a library, but when you attach the csv it needs to be to a local path (and you need to ensure that the QWC config has been edited to be able to read from that location.

you will need something like:

sub Encode(vEncodeMe, vEncoded)
    let vEncoded = replace(replace(replace(replace(replace(replace(replace(replace(replace(vEncodeMe, ':', '%3a'), '/', '%2f'), '?', '%3f'), '=', '%3d'), '\', '%5c'), '@', '%40'), ' ', '+'), '<', '%lt'), '>', '%gt');
end sub

let vOutput = 'lib://SentAlerts/';
let vFolder = 'C:\Documents\SenseAlerts\Sent\';
let vFilename = 'Attachment.csv';

let vAtt1 = '$(vFolder)$(vFilename)';

call Encode(vAtt1, vAtt1Enc);

STORE Data INTO [$(vOutput)$(vFilename)];

 

Then added to your parameters in the WITH CONNECTION:

QUERY "fileAttachment1" "$(vAtt1Enc)",

 

Actually, you may not need to do the encoding providing the attachment filename in the WITH CONNECTION, I always build out a URL with all parameters and then just use that in the WITH CONNECTION.

I've expanded on what I have put in my blog post to create a tool which automates alerts in Sense. It allows you to query various sources and check results against a threshold before the tool decides whether an alert needs to be sent. Each alert condition is configured in a spreadsheet, along with where it needs to be sent to.

A lot of the code I create like this I make available on the Community (see https://www.quickintelligence.co.uk/examples/) but I'm not sure I will be doing that with the alerting tool. If you are interested in using it please direct message me. Presently it is only available as a perk of being one of my Sense customers.

Hope that helps.

Steve

 

 

View solution in original post

4 Replies
harsha
Creator
Creator
Author

Can anyone help me out?

 

@stevedark could u look pls? 

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Suggest that you take a look at this blog post, I believe that this has everything that you need:

https://www.quickintelligence.co.uk/send-data-from-qlik-load-script/

To attach the file you will need to write it to a CSV file and then there is an extra parameter.

You will need to store to a library, but when you attach the csv it needs to be to a local path (and you need to ensure that the QWC config has been edited to be able to read from that location.

you will need something like:

sub Encode(vEncodeMe, vEncoded)
    let vEncoded = replace(replace(replace(replace(replace(replace(replace(replace(replace(vEncodeMe, ':', '%3a'), '/', '%2f'), '?', '%3f'), '=', '%3d'), '\', '%5c'), '@', '%40'), ' ', '+'), '<', '%lt'), '>', '%gt');
end sub

let vOutput = 'lib://SentAlerts/';
let vFolder = 'C:\Documents\SenseAlerts\Sent\';
let vFilename = 'Attachment.csv';

let vAtt1 = '$(vFolder)$(vFilename)';

call Encode(vAtt1, vAtt1Enc);

STORE Data INTO [$(vOutput)$(vFilename)];

 

Then added to your parameters in the WITH CONNECTION:

QUERY "fileAttachment1" "$(vAtt1Enc)",

 

Actually, you may not need to do the encoding providing the attachment filename in the WITH CONNECTION, I always build out a URL with all parameters and then just use that in the WITH CONNECTION.

I've expanded on what I have put in my blog post to create a tool which automates alerts in Sense. It allows you to query various sources and check results against a threshold before the tool decides whether an alert needs to be sent. Each alert condition is configured in a spreadsheet, along with where it needs to be sent to.

A lot of the code I create like this I make available on the Community (see https://www.quickintelligence.co.uk/examples/) but I'm not sure I will be doing that with the alerting tool. If you are interested in using it please direct message me. Presently it is only available as a perk of being one of my Sense customers.

Hope that helps.

Steve

 

 

AV1
Partner - Contributor II
Partner - Contributor II

Hi Harsha,

I'm getting HTTP Internal server error if I try to override query parameters. Any suggestion on this ?

Jaya15
Contributor II
Contributor II

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-1660649950520.png

 

want to get the 2nd table as well
using below code

Jaya15_1-1660649950560.png

 

Jaya15_2-1660649950537.png

 

Please help

Thanks 

Jaya Sharma