Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi,
I created an alert(tools\alerts) in my application qvw. but i don't find how can i attach my chart in my alert.
thanks
You can't. An alert can send a simple text only email. It is not possible to attach anything to the email.
thanks.
Yes, it is possible. Just use your imagination. A macro can be invoked from the Alert Setup. This macro can save the chart as PNG on a folder (ie: \alertsPng\) . Following the pseudo code: I just put some code together from these two great posts:
QlikView App: Export Chart and Sheet to an Image File
//So in the Alert, just call alertWithAttachment Macro
public function alertWithAttachment
//replace YOURCHARTID with the OBJECT ID of the Chart you would like to save
set obj = ActiveDocument.GetSheetObject("YOURCHARTID")
ActiveDocument.GetApplication.WaitForIdle
//just create the directory alertPngs on the current document directory
fileName = "\alertPngs\alertChart_" & replace(replace(replace(date() & "_" & time(), "/", ""), ".", ""), ":", "") & ".png"
ActiveDocument.GetApplication.WaitForIdle
obj.ExportBitmapToFile fileName
//Configure the Email Server You will use to send the Email
//Local account with password, smtp full qualify name etc.
//in summary: the credentials for sending out Emails from the computer where the document is being opened
Set serverConf = CreateObject("CDO.Configuration")
'Server Configuration
serverConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
serverConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.yourcompany.com"
serverConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
serverConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
serverConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "youremail@yourcompany.com"
serverConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "**********"
'Type your acccount Password
serverConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
serverConf.Fields.Update
//and then send it thru Email
Set myEmailMsg = CreateObject("CDO.Message")
myEmailMsg.To = "youruser@yourcompany.com"
myEmailMsg.From = "yourapp@yourcompany.com"
myEmailMsg.Subject = "Test Alert with Attachment"
myEmailMsg.HTMLBody = "QlikView test Email with attachment"
myEmailMsg.AddAttachment "\alertPngs\alertChart.png"
myEmailMsg.Sender = "QlikView App Alert Manager"
Set myEmailMsg.Configuration = serverConf
myEmailMsg.Send
//clear Memory
Set myEmailMsg = nothing
Set serverConf = nothing
end function
Hi mario,
I don't find where can i call the macro in the alert.
thanks.
Settings->Document Properties->Trigges from there you have:
Document Event Triggers,
Field Event Trigges and Variable Event Triggers
from there you can select Ad Actions->External-> Run Macro
hi,
i know that, but here i juste want to use alert.
thanks,
Do you have a condition expression for the Alert to be fired?. Then that Condition can be assigned to a variable and every time it changes will fire a variable change trigger. Can you provide your example
Hi,
For exemple
I have a straight table in which i count the nomber of case with dateA >dateB
if this table is not empty i want to send it to someone.
this is not requirement complicated, so i want to juste find a solution very simple to resoluve it.
Hi Xia,
Can't You just make a dynamic expression variable assigned at the load script as follows:
LET YourVar = '=HEREGOESYOUREXPRESSION'
note the symbol = inside the ' ' , that is being evaluated every time inside the QView document.
In the macro you can get access to the sheet object and send the alert. So it will be triggered in case YourVar equals to some condition or some value.