How to develop in Logi
Tags: analytics, visualization, programming, tutorial
Published: 2023-01-21 21:42:31

Today we will talk about InterSystems Reports. This is a BI system that provides you with tools to create static reports and export them to different file formats. We will see how it works using the DC Analytics public analytical sample as an example. In this article, we will examine how to familiarize yourself with the reports available in the repository, how to make a new report based on a ready-made data structure, and how to prepare a data structure from scratch.

![](https://lh4.googleusercontent.com/SmCwgm9ZemOQ9QnrD4NjGArA3DG_ROD_42fVkhkZjP4UJtWgVLNaSqmQ5pVroZ9Hb4zDqUmeVuMYviIFyCtTmACWiFFg2qkKbGN2thDql14p4wahp_6qtv4z66OizR8xu5V3wtfVqcp60Bwnl7r0DhBDqjdRWi--wPOowBpa00xoD_0hJVQQgawETVDepA) 

To begin with, you need a licensed copy of InterSystems Reports. 

You can obtain your copy of Logi Designer or Logi Server from WRC:

 [Linux](https://wrc.intersystems.com/wrc/WRC.StreamServer.cls?FILE=/wrc/Live/GeneralKits/IRIS/iscreports_designer-19.0.0.4-linux.bin) [(https://wrc.intersystems.com/wrc/WRC.StreamServer.cls?FILE=/wrc/Live/GeneralKits/IRIS/iscreports_designer-19.0.0.4-linux.bin](https://wrc.intersystems.com/wrc/WRC.StreamServer.cls?FILE=/wrc/Live/GeneralKits/IRIS/iscreports_designer-19.0.0.4-linux.bin)), 

[MacOS](https://wrc.intersystems.com/wrc/WRC.StreamServer.cls?FILE=/wrc/Live/GeneralKits/IRIS/iscreports_designer-19.0.0.4-osx.tar.gz) 

[(https://wrc.intersystems.com/wrc/WRC.StreamServer.cls?FILE=/wrc/Live/GeneralKits/IRIS/iscreports_designer-19.0.0.4-osx.tar.gz](https://wrc.intersystems.com/wrc/WRC.StreamServer.cls?FILE=/wrc/Live/GeneralKits/IRIS/iscreports_designer-19.0.0.4-osx.tar.gz))

[Windows](https://wrc.intersystems.com/wrc/WRC.StreamServer.cls?FILE=/wrc/Live/GeneralKits/IRIS/iscreports_designer-19.0.0.4-windows.exe) ([https://wrc.intersystems.com/wrc/WRC .StreamServer.cls?FILE=/wrc/Live/GeneralKits/IRIS/iscreports_designer-19.0.0.4-windows.exe](https://wrc.intersystems.com/wrc/WRC.StreamServer.cls?FILE=/wrc/Live/GeneralKits/IRIS/iscreports_designer-19.0.0.4-windows.exe))

To get access to the WRC, your company should be a client of InterSystems Corporation.

Also, you will need drivers for providing InterSystems Reports JDBC connections to data sources. You can find them here: <https://github.com/teccod/Logi-JDBC-drivers>. To use those drivers, you can place the lib folder in the root folder of Logi Report Designer's installation directory.

![](https://lh3.googleusercontent.com/8jjTmC_p1Btf8rzRQ5_xB_-HSD52DlETGK3U3BeNu45VmP8PR3npPpOTal5n9dN5o-0F7WYpE9Z6YaKDPtqZ_J4iEG4EzpHvS8d2Op5aP2Dqdd6sJDtsYtQSnGbn1aL314pJZq5PxdXxlvviiPxGw1D6EI0ksMAqmmTD7EvBiOrvE4K_TytfRfLUw7aImg) 

Report files on InterSystems Reports are located in the repository below: <https://github.com/intersystems-community/dc-analytics/tree/master/analytic_dashboards/logi%20report>

There are 2 folders here. One of them contains a report about activities in the English-speaking community in DC (folder ‘[En report](https://github.com/intersystems-community/dc-analytics/tree/master/analytic_dashboards/logi%20report/En%20report)’). The second one includes a statement about distribution of English-speaking users across other language communities (folder ‘[members by community](https://github.com/intersystems-community/dc-analytics/tree/master/analytic_dashboards/logi%20report/members%20by%20community)’).

Each folder retains 4 files. The .pdf file encloses an example of a report generated in InterSystems Reports. The .cat files holds the data structure and all the necessary settings for connecting to Adaptive Analytics. The file with the ‘localhost’ attribute is configured to connect to the Adaptive Analytics instance in Docker container. It deploys from the repository. In the file with the  ‘public_demo’ attribute, the connection to Adaptive Analytics deployed on the demo server is configured. The .cls file incorporates all the visual elements of the report. 

InterSystems Reports is organized in such a way that allows you to open a data structure file first, and then go to any other file with visualizations in the same folder. In this case, if the visualizations are configured for a different data structure, you will receive an error message. This structure gives you an advantage in two situations. The first one is that you can have multiple data sources with the same structure that lets you develop only one report file and simply open it from different .cat files to generate all other reports. The second one is that you can develop multiple reports for one data source, where all queries and formulas that you have created for one report will be immediately available to you in others.

To view the contents of the report, you need to launch InterSystems Reports, click the “Browse” button on the start page. Then use the “Browse…” button in the “Open Report” dialog box to select the path to the .cat file of the report. 

![](https://lh6.googleusercontent.com/vikccel5DB9ghXjRSlOKbv7Kg1wjmvFAPIRO_K8rn2ls42ueYe7wySG2rStXvoYzczgc2IbAE2AhaZTjzLYp9h95eujJhIAbkGgt2obR6lac3aK8SBbV5sDOABc9hYsiwEgg0BKz4MYrqVRwHEfID_Phn9IM0gJ67mtMBp2ESdDxmQSi4LOHUQ1MhQOyDQ) 

In the Reports tab, you will be offered a .cls file of visualizations. All .cal files that are in the same directory as the .cat file are available in this tab.

![](https://lh3.googleusercontent.com/AIhWvfVndFHZcm4uDumlxp7Tvp_2BTanvp0pG6RaWCMU6L4G48ln1xrD5-AU40razGV7mK4iFmT3dlnBuPeTrskTdTW-mBMZX-ZE3OUgbVhczhPZR6uTe10D7zJ4AYt6npmu9KkA4GNFUyDaG4JD_CushzDZKbKTqcoqiWGV4rMY3xJhxLZ8wnNV8GvvAg) 

After opening the .cls file, you will find yourself in the report editing interface. In order to fill in the report with data and see its output, you need to switch from the Design tab to the View tab in the central window.![](https://lh5.googleusercontent.com/TSMBhc0GyMMa5dzHK8swQZyx_SVWwS_SvxOXlX05Z9vaCqcv_qdM9XmRcc-BA4TCcxP8-Jy_FbxMyWIaEZJ77sDhpl0WZQUc6M5FgF7V2C3wIAHvSKOJwSyXvPsOi-tSheS8B3AX8psBQt1OR1JkVZlNROolbyoo_H6mCDPZ45MxuzW7GtN6JCC7axiwFA) 

After that, InterSystems Reports will start sending queries to the data source and generating a report. The report will be generated page by page as soon as the data is ready.

![](https://lh5.googleusercontent.com/eDQ0IE5iupFOlAHGfPnR9ce2Ty0G-Xr1wL8r0Z5J_S_b3WnfwnBdIOl5xPTsOobdxsBe1zlDk0kV564M9-FTocEeNzZDnYRHziVWWiYomrPFoDFw-csthbdolgFJLtVL1kZi5udvgKR3arrsu1JJkG5wReD5Hq2EbvvyRjPR0CZjPBltYRbsaQmcaUJFGQ) If you want to save the report in a file, you can go to the File tab on the top menu and find the "Export" button in that tab. You will be offered various report export formats. 

After selecting the format, you will be prompted to a window with export settings. After configuring, the file will be immediately generated on your disk. If you do this procedure from the Design tab, then before generating a report, InterSystems Reports will first request all the necessary data, and only then export the report to a file. At this time, the editing interface “freezes” so you will be able to understand that the file formation is completed when you again get an option to do something in the Design tab (for example, scroll the report layout in it).

If you want to create a report yourself based on public analytics data, you will need to know the structure of data transfer from the source to the widget in the report. The first step is to establish a JDBC connection to Adaptive Analytics. To do this, we should specify the connection settings: a link from the Adaptive Analytics interface, login and password for access to the Adaptive Analytics instance. This will establish a connection to one of the projects in Adaptive Analytics. You can find out what a project is and where to get a link to connect to it in a separate article about Adaptive Analytics.

![](https://lh6.googleusercontent.com/IJl1xvhOrsDxaRTahjnuhhHnK6CDqtWzT_iWhZgx-3wKJAlEAKkn57PnqSnWUuu3cN0nwi_1KvMAw3chaD5KGyeAIUIgP_MMdJ33DsTVGWZyHNm6O_x1z5FwqRFh6yfaYin6_-0uo0ji6gh1iRS7HCbQOVhL0dvSXN14AWZ_mpBXA_ra9COHUgJU7-Q7zg) 

Once the connection is set up, we can add cubes from Adaptive Analytics to the .cat file, that will look like a table with a set of columns. 

Based on those tables, we can build queries where we can select only the required columns and apply filters to the data.

![](https://lh4.googleusercontent.com/xSWzqi0hq10tB5uky4VK580y_p7MxcLAKrfxsDVaE1DAsj70ZDmSjF3i6EUkExg5MbphVkchHRdrkYYh7EizCOjgqeEKb0naYReGJvJ2rv1QehsEfGiWCp2wwuvDSo6yCkmvXUzhuKql8b1NFD-k-MzfJRXQ54Dw9cHWiHBD8ZWk2fCM0dMLCPWSMzskAw) 

Inside queries, we can build additional calculated columns, write formulas for data transformation, and do aggregations on data.

Formulas and aggregations done in one query will be available in all other queries based on the same table and containing fields used in formulas and aggregations.

Any widget is based on one of the queries. In this case, InterSystems Reports will create a separate query with a unique name for each widget. You can manually change such queries for each widget or create new ones. When copying a widget, the copy will hang on the same query as the original. Sometimes this leads to problems when creating reports. This is why you should be aware of this.

![](https://lh5.googleusercontent.com/REdWAP90x3-BRtGrIn_wx0FGadsGNGQIKSI2xiarXrZouMLQVDE6N-ER7HWNmjNpaBhFJT922mnQlE7JuMLPBM-tXYz1s8p5I6QYkYHoe4AfBJpbcJeuGiGq2YfVJSxOd8US32dl-Q7WMGlZZtJyIUgR_jCz6Pr_E20xLFO_KbaTPSztSzZbs7wuYQMLtA) 

In summary, there are 2 levels of queries. The first one is created in the .cat file and is responsible for columns and filters that will be used in the query. The second one is assembled in the .cls file and is a copy of the first type query. When generating a report, InterSystems Reports sequentially executes queries of the second type and passes data to the widgets associated with those queries.

When building a widget in a report, fields from a query and formulas behave in the same way - like a data field. Aggregations are usually done based on two fields. For that reason, when you add an aggregation to the same line chart, it will immediately take both: the x-axis and the y-axis.

![](https://lh6.googleusercontent.com/3juEDqTOBQU2qC-SNVTc4K_O4yb1XpRGRKRZaOn3Mt_sa6he_PRiXJ8brpnlyfYKqPx_za7PzbDBxSO1-Vb3LrawkXRNNXqFBJLhdN9HJLfXTo4w0MVsULlByjHfs_4bz0Wv6_kXqQ8JV7XP29tc4ugcCxz7zjJXWC2erfEGhfILagkxLi41YpEwjHHS5w) 

Once you know how InterSystems Reports works, it will be easier for you to figure out how specific data visualizations are built. You can find all necessary information in the documentation and guide for beginners, which are prepared by the developers of InterSystems Reports.

You can find tutorials for beginners following this link:

<https://devnet.logianalytics.com/hc/en-us/articles/4405661266455-Track-1-Creating-Page-Reports>

Documentation for the latest version is stored at this link:

[https: //devnet.logianalytics.com/hc/en-us/sections/5735298972439-Logi-Report-Designer-v19](https://devnet.logianalytics.com/hc/en-us/sections/5735298972439-Logi-Report-Designer-v19)

There is also an old version of the documentation site, which I find more convenient (probably because I'm used to it). This link only has documentation up to version v18:

<https://documentation.logianalytics.com/rsg/content/html/install/issue.htm>

In order to save the changes you made in the report, you need to save both files: .cat and .cls. The .cls file is saved on the File tab of the top menu. This tab has a section with a “Save” button. The .cat file is saved on the Home tab. When you click on the “Catalog Manager'' button, a catalog editing window will pop up. In this window, there is a “Save Catalog” button. If you decide to exit the program without saving the changes, you will also get 2 dialogue boxes asking if you want to save the changes in the .cat and .cls file.

For Git, .cat and .cls files are binary. However, all of us know that the .cls extension is also reserved for IRIS classes. Hence, we recommend saving the files for Intersystems Reports in a separate folder in the repository. Remember to change the settings in the .gitattributes file according to the fact that all files in the folder are binary. 

![](https://lh3.googleusercontent.com/FjNyDGpYqs2qTCQo9Y6shJLUhggj4oZNkalrrSc4xcOHDhLaUCEcG4TkSFfqzsqr408cB6-fUgm1cJc87RQRkdNsoHDzpwoyndZPTFjP-VMeWcdoU6GOkh24BYj89NL8b5zFPEqHXkdp-Y954iDgXE4TMF-wgbOjeY3jIvMr79n30wM7xJz_HCWdFmlkuQ) 

You can find an example of such implementation in the .gitattributes file in the DC-analytics repository.