How to create an event driven report with zenon Analyzer using a VSTA macro in the zenon runtime and send it optionally as an email attachment with message control

zenon Analyzer not only offers manual report generation, it enables the creation of reports based on schedules and can generate them event-driven. The event-driven report generation is able to create reports based on external events, such as the end of a lot production. In this case, the zenon Runtime works hand-in-hand with the zenon Analyzer.

General description:

zenon AnalyzerThis functionality needs to be implemented in zenon using a VSTA macro. The triggering event starts this macro which sets the parameters like report template name, rendering format (e.g. pdf, jpg, html, …), time filters, event classes, … to the zenon Analyzer, using the Reporting Services Web service interface. The zenon Analyzer processes the report and returns the rendered report to the VSTA macro of the runtime for further processing. The VSTA macro can store the report in a file share or send it by message control as an email attachment.

Detailed description:

1. Information collection:

First the required parameters, which are needed to call up the VSTA macro, are determined. Two different

cialis order

types of parameters exist. Those which are necessary for the report itself and those which give additional information and control the report generation.

Report parameter:
In order to be sure about the report parameters, we suggest to open the report in the Microsoft SQL Server Report Builder 3.0 and check them in the parameters section.

Other parameters;
Are rendering methods and project name.

2. VSTA programming:

Creating a Web service reference:
To create the required reference you can use the VSTA-Editor or the wsdl.exe (Web Services Description Language), provided by several Microsoft SDKs (.NET SDK, Windows SDK, Visual Studio, …)

C#-code:
It is important that the macro is running in its own thread, otherwise the runtime will be blocked and a deadlock is created!

In the C#-code the following parameters are passed to the zenon Analyzer:

    • rendering method
    • project
    • report execution parameters (e.g. time filters, …)

Now the VSTA macro waits for the report to be processed from the zenon Analyzer and be returned to the runtime. The macro now can save the report under any name on the hard drive or send it as an email extension with message control.

3. Finally the C#-code needs to be saved as a ProjectAddin.

 

Possible usages:

  • manual activation with a button in the runtime
  • automatic activation for violated limits
  • automatic activation using scheduler or Production & Facility Scheduler
  • automatic activation using a time control function

 

Although the C#-code has a limited length, it would exceed the scope of this blog.
For implementation comprehensive documentation, including code samples, is available.

 

Tags: , , ,

Leave a Reply