Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

MuraliPrasath
Contributor II

How to send report out to user by image format?

Hi,

I'm using Personal Edition.

I've to send report to user's emails with image (JPEG) format.

I've a requirement like based on the customer column it should filter values and sent out to users email as image (jpeg) format, and also image should be seen in the body of the email page.

How to achieve this?

Thanks in advance,

Murali

Tags (1)
6 Replies
sushil353
Honored Contributor II

Re: How to send report out to user by image format?

Hi,

Goto File>Export>Export Sheet Image

HTH

Not applicable

Re: How to send report out to user by image format?

Hi Murali, You want to send the report as IMAGE or you want to send the Image along with your report

MuraliPrasath
Contributor II

Re: How to send report out to user by image format?

My report should be on image format and that should be sent out to users. I believe we can do it with module editor. Need help on sending reports as a image format to users.

saimahasan
Contributor III

Re: How to send report out to user by image format?

You need to write macros for exporting chart as image and then mail it to users. You can even attach the image in mails body through macro

jarebpat
New Contributor III

Re: How to send report out to user by image format?

Hi Murali,

I've been able to do this and have been using it in multiple apps/reports for a couple of years. As a summary, we use a chart in a Qlikview app and capture it as a image, which gets emailed out to specific people. The same chart is re-used for different people, by using a list box that filters for those people. All this needs to be run via a macro within the macro module in Qlikview. It isnt the most efficient way, but it does the job, basically the app is triggered to open from a windows task scheduler, the data is reloaded, then the filters are applied, then the macro is run, which in our case uses Outlook for each image, (you can have a collection of images per email or just one image). The email is sent and then the macro goes to the next list box option and loops the export part, until it is complete and then the app closes, until next trigger.

Since there are a few steps in play, let us know which one you need help with. A lot of material on the community sites regarding export, macros, etc...

You will have to fine tune the export part, so that it looks good in the email, also quality of the export so that your emails aren't huge, etc.

Hope this helps!

hectorvega
New Contributor III

Re: How to send report out to user by image format?

I am using a macro to store  the objects to JPG and then send those files to the recipients you want as an embebed image on the mail body.

 

The macro is :

Sub Init
               
   Set Button1 = ActiveDocument.GetSheetObject("OBJECTID_HERE")
   'Make a button on the designer and

   Button1.Press           
  
end Sub

sub CreaObjetos

     ActiveDocument.reload
     ActiveDocument.GetApplication.Sleep 2000
     ActiveDocument.Save
  
     ExpJPG "TX213","Logo"
     ExpJPG "CH218 Sales","GraphSales"    
   
     PrepareReports
            
End sub  


Sub PrepareReports 
                   
     ExportEmail "One.person@domainx.com"
     'ExportEmail "other.person@domainx.com"
     ActiveDocument.Save 
     ActiveDocument.GetApplication.Quit              
              
end sub

'-------------------------------------------------------------------------------------------------

   
SUB setVariable(varName, varValue)
set v = ActiveDocument.Variables(varName)
v.SetContent varValue, true
END SUB

        
Sub ExpJPG(ObjId,ResName)
  Set Objeto = ActiveDocument.GetSheetObject(ObjId)
  Objeto.ExportBitmapToFile  "C:\dashboards\email\"& ResName &".jpg"
end Sub

              
Sub ExportEmail(Correo)
  
  Dim objEmail
  Const cdoSendUsingPort = 2    'Send the message using SMTP
  Const cdoAnonymous = 0        'Do not authenticate
  Const cdoBasic = 1            '    basic (clear-text) authentication
  Const cdoNTLM = 2             '     NTLM
  Const SMTPServer = "mail.domainx.com" ' changed for public consumption
  Const SMTPPort = 25                 ' Port number for SMTP
  Const SMTPTimeout = 120              ' Timeout for SMTP in seconds

  Set objEmail = CreateObject("CDO.Message")
  Set objConf = objEmail.Configuration
  Set objFlds = objConf.Fields

  With objFlds

           .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Business.Intelligence@solmar.com"
           .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = your_pwd_here"              
           .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort 
           .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer 
           .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic  
           .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort 
           .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 
           .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = SMTPTimeout 
           .Update

  End With

  objEmail.To =  Correo    '"sender.person@domainx.com"    'Aqui sera Correo  
  objEmail.From = "sender.person@domainx.com
  objEmail.Subject = "Report Name Here"
 

  HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & chr(13) & chr(10)
  HTML = HTML & "<html>"
  HTML = HTML & "<head>"
  HTML = HTML & "<meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"">"
  HTML = HTML & "<title>Title here</title>"
  HTML = HTML & "</head>"
  HTML = HTML & "<body bgcolor=""#FFFFFF"">"

'-------------------------------------------------------------------------------------------------------

  HTML = HTML & "<table border=""1"" cellpadding=""1"" cellspacing=""1"">"
  HTML = HTML & "  <tr>"
  HTML = HTML & "    <td align=""center"" ><img src=""cid:Logo.jpg"" ></td>"
  HTML = HTML & "  </tr>"
  HTML = HTML & "</table>"
 

  HTML = HTML & "<br><img src=""cid:GraphSales.jpg"" >"

 
  HTML = HTML & "</body>"
  HTML = HTML & "</html>"

'===============================================================================================================================

  Set objBP = objEmail.AddRelatedBodyPart("C:\dashboards\email\Logo.jpg", "Logo.jpg", CdoReferenceTypeName)
  objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "<Logo.jpg>"
  objBP.Fields.Update

 
  
  Set GraphObj= objEmail.AddRelatedBodyPart("C:\dashboards\email\GraphSales.jpg", "GraphSales.jpg", CdoReferenceTypeName)
  GraphObj.Fields.Item("urn:schemas:mailheader:Content-ID") = "<TxtRojo.jpg>"
  GraphObj.Fields.Update 


 
  objEmail.HTMLBody = HTML

 
  objEmail.Send
 
 
  Set objFlds = Nothing
  Set objConf = Nothing
  Set objEmail = Nothing

End Sub      

' ---------------------------------------------------------------------------------------------------------------------------------------------------------

Please let me know if you need more help on this.

Regards

Community Browser