📜 ⬆️ ⬇️

Snap is a new reporting platform. Part 1

It's great when reports are made not by programmers, but by the users themselves. But most existing report designers are incredibly complex. Imagine how great it would be if your chief accountant could design his reports right in Word! Fantasy? Not at all. This is Snap from DevExpress .

See for yourself how easy it is to use this control for programmers and end users:


')
Under the cat you will find a detailed description of everything that Snap can do at the moment.

We did not write a new product from scratch. It was based on our Rich Text Editor , which implements the entire infrastructure for creating complex documents, both from the user interface and completely from the code. Using Rich Text Editor allows you to conveniently and quickly create templates for simple and master-detail reports without requiring additional software , and then change them without being tied to the internal device of a specific format . A serious advantage to this is the ability of the end user to use the skills of working with Microsoft Word.

Then we added the Data Source Preparation Wizard, which is used in our components, allowing users to add the data they need to work with little or no developer intervention.



You can specify data sources not only through the user interface. There are choices - in design mode or dynamically from the code, at the stage of program execution. Once the data source has been selected and properly configured, you can start creating full-fledged reports.

The data structure will be visually displayed in the browser panel. In order to get the finished document, simply select the required fields and drag them to the right place, or simply double click on them - in this case they will be added in accordance with the current position of the carriage. If you need to add data to an already created table, this can be easily done using hot zones.



At the same time, real data will be used immediately - in fact, the designer does not just create placeholders for dynamic content, but shows the final report view. The only difference from the final result is that the design mode uses a limited number of entries. The selected data will automatically be grouped into a table, but if you wish, it can be easily converted into plain text.

Also, the process of inserting data can be more finely tuned using a thoughtful set of events that notify each step of preparing a document.



At the same time, you can use any number of independent data sources for a single report, and using tables or multi-column markup of a document, you can easily compare them.



Importantly, Snap is a WYSIWYG editor in the full sense of the word. Regardless of whether you are creating a new report, modifying an existing one, or using the print preview function, the document looks exactly as it will appear on paper.

In addition to simply inserting data into a document, Snap provides an impressive set of functions for processing and presenting them in the right form, which includes the possibilities of grouping, sorting, filtering, analyzing and calculating, using parameters and calculated fields, formatting results.



Not all data is conveniently presented in plain text. Snap has a whole arsenal of data visualization tools, including checkboxes, images, barcodes, graphics, and sparklines.



No reporting tool can be called complete if it does not provide an easy and convenient way to create hierarchical reports.



A widespread scenario that I would like to dwell upon is mail merge - creating a large number of similar documents based on a common template, in particular, preparing a mailing list with extracting names and addresses from a database. In order to switch the document to the preparation mode of such a template, simply select the appropriate context menu item for one of the added data sources.



Of course, you can also select the data source in this way from the code. After that, Snap will treat the entire document as a template that must be repeated for each entry in the source. At the same time mail merge mode also supports hierarchical data for creating reports.



After the necessary data is added to the template, it can be processed as in the case of a regular report. You can sort by to sort the records based on the value of one or more fields.



And you can filter the data to show only the necessary information. Snap provides two possible scenarios for filtering data. You can simply explicitly select the records that should be displayed:



If simple selection is not enough, you can create a complex sampling condition using the appropriate dialog:



Now that everything is ready, you can see the result for a particular entry:



Or get the final result by sending a report to print, export it to any supported format (for example, doc, docx, rtf, odt, html, mht, pdf) or display it in a separate window in preview mode. You can also choose which records should enter the final document and how to separate each of the records.



Since the operation of creating a resulting report can take considerable time, we made sure that it was executed in a separate thread, allowing you to interact with the main application, monitor the progress of the generation and, if necessary, interrupt the creation of the report.



The boring standard form can be easily replaced with something prettier:



Now, a fly in the ointment - currently Snap is represented only on the WinForms platform.

Nevertheless, I really hope that the product has interested you. You can get to know him closer by downloading the trial version .

In the second part of the article we will look under the hood and take a closer look at the technical details. I will demonstrate working with the API using the example of popular tasks arising during the preparation of the report and I will try to prove that the ease of use by the end user was achieved not at the expense of functionality. If you have any questions - ask them in the comments, I will be glad to answer all.

Source: https://habr.com/ru/post/227691/


All Articles