2 Replies Latest reply: Dec 10, 2013 5:18 AM by Tobias Löwenthal RSS

    Onpost Reload to Trigger Macro Failed

    Heri Zhang

      Hi All,

       

      I have a macro send email to tell me that the process reload is succes. The macro is excecuted OnPost Reload qvw automatically, with the schedule reload in QMS. The macro working fine in Qlikview desktop, but its not working in qlikview server.  Anybody can help me?

       

      I had add 'Macro override security' in the QVW and check the 'Allow macro execution on server','  Allow unsafe macro execution on server' on QMS. But it still not working.

       

      Below is the macro I am using:

       

      sub SENDMAIL()
      Dim objEmail
      Const cdoSendUsingPort = 2
      Const cdoAnonymous = 0
      Const cdoBasic = 1 
      Const cdoNTLM = 2 
      SMTPServer = "mail.xxxxx.xx.xx"
      Const SMTPPort = 25 
      Const SMTPTimeout = 60
      'Sending mail
      Set objEmail = CreateObject("CDO.Message")
      Set objConf = objEmail.Configuration
      Set objFlds = objConf.Fields
      With objFlds
      '---------------------------------------------------------------------
      ' Detalles del servidor SMTP
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous 
      .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 = "abc@xxxxx.xx.xx;def@xxxxx.xx.xx"  
      objEmail.From = "mail@xxxxx.xx.xx"
      objEmail.Subject = "Reload Qlikview Success" 
      objEmail.TextBody = "Schedule Reload Qlikview Success" 
      
      objEmail.Send
      Set objFlds = Nothing
      Set objConf = Nothing
      Set objEmail = Nothing
      end sub 
      
      
        • Re: Onpost Reload to Trigger Macro Failed
          Bill Britt

          The Reference manual states the following:

           

           

          82.3 Macro trigger limitations

           

          The following triggers are not to be used in the QlikView Server environment, since they lack meaning or

          may cause unexpected results:

          OnPostReduceData

          OnPostReload

           

          Bill

          • Re: Onpost Reload to Trigger Macro Failed

            Bill has already pointed out that the Publisher will not execute certain triggers.

            However there is a workaround to this. Basic principle is:

            1) Create a CMD file on the QlikView Server that will start the reload

            2) Create a Windows task that will run the CMD file

            3) Create a CMD file that calls the Windows Scheduler

            4) In the QMC go to 'Systems' tab, select 'Supporting Tasks' and 'External Programs' and create a new external program task. On the 'Triggers' tab of the just created task, it can be attached to any other existing task.

             

            Hope this helps!

             

            Best regards,

            Tobias