At the dawn of his career, he had to deal with the maintenance and writing of accounting programs and accounting systems. Since then, despite the fact that 18 years have passed, the rejection of everything related to accounting and reports has been steadfastly held. And who would have thought that fate would send me to a company that develops a report generator. My whole nature was stretched (and continues to stretch) to system programming, and participation in the development of software for generating reports is a punishment for the sins of youth. As a matter of fact, this article talks about the attempt to “break out of the cage” and combine the incompatible - system programming and report generators.
Have you ever written documentation? And if they wrote, what style was used - a dry description of the protocols or a live narration? Why, I ask, because at one point I realized that my project required documentation. Unlike the user's manual, the description of the protocols is a boring and monotonous document without allegories and lyrical digressions, only message formats describing the parameters transmitted and returned. I used to use Microsoft Word and a style sheet for such things, but as it turned out, it’s very difficult to maintain an exact style with a monotonous description of the protocols. Do not believe - try it yourself.
At some point, an idea came - why not use a report generator to describe protocols? Firstly, there is no need to buy funds to generate documentation, secondly, the ability to become a user of a product developed by my employer, thirdly, the ability to export to various formats, fourthly, a real opportunity to separate information from its presentation.
No sooner said than done. As a source of information was taken Microsoft Access database. The structure of the database is organized as follows - the main information is located in three related tables:

The
Protocols Master Table contains a list and description of the basic protocols.
Detail
Methods table contains a list of protocol methods (functions).
Subdetail table
Arguments contains a list of parameters (arguments) for each method.
')
As a generator of documentation - FastReport.VCL report generator. Start the report designer, select the Data tab and create a new ADO connection:

I used the assistant built into the report generator and received the following line:
Provider = Microsoft.Jet.OLEDB.4.0; User ID = Admin; Data Source = ProtocolsSpecifications.mdb; Mode = Share Deny None; Jet OLEDB: System database = ""; Jet OLEDB: Registry Path = ""; Jet OLEDB: Database Password = ""; Jet OLEDB: Engine Type = 5; Jet OLEDB: Database Locking Mode = 1; Jet OLEDB: Global Partial Bulk Ops = 2; Jet OLEDB: Global Bulk Transactions = 1; Jet OLEDB: New Database Password = "" ; Jet OLEDB: Create System Database = False; Jet OLEDB: Encrypt Database = False; Jet OLEDB: Don't Copy Locale on Compact = False; Jet OLEDB: Compact Without Replica Repair = False; Jet OLEDB: SFP = False;
Then I added three data sources to the ADO connection, linking them together to a Master-Detail-Subdetail bundle using three SQL queries.

Here are the queries:
Protocols:
SELECT P.Name, P.Description, P.ProtocolID, P.Description_Rus FROM Protocols P
Methods:
SELECT S.ProtocolID, S.Label, S.Name, S.Description, S.Description_Rus, S.ID FROM Methods S WHERE S.ProtocolID =:ProtocolID ORDER BY S.Label
Arguments:
SELECT A.ID, A.InOutFlag, A.Index, A.TypedUntypedFlag, A1.Name, A.Name, A.Description FROM Arguments A INNER JOIN ArgType A1 ON (A.TypedUntypedFlag=A1.ID) WHERE A.ID =:ID ORDER BY A.ID , A.InOutFlag DESC, A.Index
After that you can add a new page to the report and compile the report.

Have you ever compared the hardware specifications from Intel and AMD? If so, then in whose favor? In my opinion, the documentation from Intel is more convenient for perception and work with it due to the presence in the document of many cross-references and a magnificent outline. To add outline to the documentation, it is necessary to tell the report generator how and where to get the information. For this, the band object (the data selected from the database is actually displayed on it) has the OutlineText property, which can be filled with both static text and from the database. Since the bands can be nested, the information in the outline is obtained in the form of a tree where the branches correspond to the nesting of the bands:

The best part is that when exporting the generated document to PDF, the outline is also exported.
This article would not have appeared if I didn’t feel a bit crowded within the framework of the FastReport.VCL report generator. The fact is that in one form or another I already played up using the report generator to create documentation on various Internet resources, but suddenly a whim came to me in the form of a desire to make the same exact report with the help of another product - FastReport.NET. Using the report converter, I found that the appearance without any problems was transformed from a report from the FR.VCL format to the FR.NET format. The joy is over - the data sources were lost during the conversion. It was necessary to re-create (using the "wizard") a connection to the database. As a result, we got the following line:
Provider = Microsoft.Jet.OLEDB.4.0; Data Source = ProtocolsSpecifications.mdb; User ID = Admin
And SQL queries acquired the following form:
SELECT P.Name, P.Description, P.ProtocolID, P.Description_Rus FROM Protocols P
As you can see, the request for the protocols has not changed. And in two other queries, the
WHERE clause disappeared.
SELECT S.ProtocolID, S.Label, S.Name, S.Description, S.Description_Rus, S.ID FROM Methods S ORDER BY S.Label
and
SELECT A.ID, A.InOutFlag, A.Index, A.TypedUntypedFlag, A1.Name, A.Name, A.Description FROM Arguments A INNER JOIN ArgType A1 ON (A.TypedUntypedFlag=A1.ID) ORDER BY A.ID , A.InOutFlag DESC, A.Index
instead of the WHERE operator, in the “Data” window, select the “Action” menu, then select the “New link” menu item and assign the link between the subordinate table and the main table.
After the completion of editing, simply hold down the Ctrl key and click on the Latin
P or “click” the mice on the magnifying glass icon to generate documentation and preview the received document.
I can not compare FR.VCL and FR.NET. When generating documentation, FR.VCL showed the best results in the speed of report building. At the same time, FR.NET offers a slightly larger number of export formats (for example, the XPS format), a slightly more modern interface, and a certain margin of fault tolerance at the expense of the managed code.
For those who think that it’s better to try it yourself once, than 10 times to read, I
post the original database and two report templates in FR3 (FR.VCL) and FRX (FR.NET) formats in a zip archive . Download FastReport from the
official site . You will need to open the report in the designer and edit the path to the database in the report -
in the connection string you must specify the full path to the ProtocolsSpecifications.mdb file. I apologize for the inconvenience.
Finally, I would like to once again turn to the advantages of this method of describing protocols and dream a little. The main advantage is the separation of information and its presentation. The developer focuses on the protocol description, and the report generator takes care of the appearance. The ability to easily export a document to many common document formats.
If MS Access is replaced with any SQL server and provided for users to edit the database via the WEB interface, it is possible to produce remote development of protocols by several developers at once. Fortunately, the report generator has a server version that can generate reports on the fly and send them over the HTTP protocol.
Finally, the database can be used as an analogue of IDL (Interface Definition Language). Those. Virtually nothing prevents the generation of C / C ++ header files with the description of interfaces directly from the database.
Thanks for attention.