Today, in this article, we will tell you about the expression calculation mode in a report. Actually, there can be only two – Interpretation and Compilation. These are common concepts; however, this article will be about their meaning within the Stimulsoft platform.

Report calculation mode

The expression processing mode is defined for each template separately. By default, when creating a new report in the Stimulsoft Designer, the Compilation mode is used for it. When creating a new dashboard, the Interpretation mode is used. Since this setting refers to a template, you can change the processing mode using the report template called the Calculation Mode. In turn, its value can be either Interpretation or Compilation. Please note that all our dashboards work in the Interpretation mode.

What mode should I choose?

The thing is that the Compilation mode is not supported for some platforms and accordingly our products, too. In this case, all expressions will be processed in the Interpretation mode. As a result, the following will happen - what worked locally, for example, will not work in the cloud. And it’s not about errors in a product, but about services and platform safety.

Conclusion. Before defining the report calculation mode as Compilation, you should be sure that the platform supports it. By default, when creating a new report in products, where the compilation is not supported, the calculation mode will be defined as interpretation. To process a report in interpretation, our engine uses its own interpreter.

By the way, the compilation mode is supported in the following products - Reports.Net, Report.Wpf, Reports.Web, Reports.Angular, Report.Blazor (only for Blazor.Server). The compilation mode is relevant only for reports in these products: Stimulsoft BI Server, Dashboards.WIN and Dashboards.WEB.

Code tab

Since our article is about the expression calculation mode and report processing, we should remind you that our designer allows you to see report code, which the compiler or interpreter will process. You should open the Code tab, which is hidden by default, to see the code. You can enable it from the context menu of the report template page header, having checked the box next to the Code parameter. Two important things - first of all, Professional skill level should be selected in the report designer. About skill levels, you can read a detailed article. Secondly, the Code tab contains a code of the entire report, not a certain report template page.

So, after you open the Code tab, you should check the box next to the Show auto-generated code parameter in the context menu of the code editor area. As a result, report code will be generated, which when creating will be processed by the translator.

Code Tab

Details

Now, we will tell you how all of this refers to Stimulsoft. As far as you know, the compilation is a program translation written in a high-level source language into an equivalent program in a low-level language. Firstly, the code is analyzed, then it is translated into a low-level language and execution. When interpreting code analysis and its execution is carried out line by line. However, our engine uses its interpreter, but unfortunately, it can’t process expressions in events. So, event scripts in the interpretation mode will not work. However, there is always a solution, and you can read about it below.

Events

When creating reports, you can use component events or report events. In other words, you can define an action that will trigger when a situation occurs. For example, before starting to render a report or when it is exported or if the number of rows in a report will be more than 10. Generally, we can write many articles about events in a report, and using events and scripts in them is limited only by your requirements for reports.

Attention!

  1. An event is a script that is carried out when a specific situation occurs. This script is written in the programming language of the product you use. For Stimulsoft Designer, it is C# / VB.Net, for example, for Reports.JS – JavaScript. According to this fact, we can conclude that the report script, which works in the Stimulsoft Designer, will not be carried out in Report.JS.
  2. In our engine, an interpreter is used, which can’t process expressions in events at the moment. That’s why event scripts won’t work in the interpretation mode.

What does Blockly have to do with it

Not so long ago, we integrated Google Blockly into our products. This feature allows you to create event scripts using visual blocks. When an event occurs, a script is processed using our special library to analyze and calculate the expressions created using blocks. This way, the scripts created using Blockly will work in the interpretation and compilation mode. That’s why creating scripts using blocks is a solution when the report calculation mode is set as interpretation.

Blockly Events
Attention!

When creating a script using visual tools, the syntax of the programming language is not used. Processing this script is implemented separately for each platform. The script created using Blockly is a universal one, and it doesn't depend on a product where it is implemented. This is relevant when developing a report, for example, in Reports.Net and then its rendering in Reports.JS.

The main points in a nutshell

So, we have told you a little about the report calculation mode. In addition, we would like to repeat main points:

  • The calculation mode is defined using template properties and can be set as Compilation or Interpretation;
  • Not all products support the Compilation mode;
  • Expressions in scripts are not processed in the interpretation mode;
  • The scripts created using Blockly will work in the interpretation and compilation mode. Also, these scripts are not dependent on the platform or the programming language you use. In fact, they are a universal solution for all platforms.

We hope that the article is useful for you.
By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.