3.3. Report for a List of Entities

The reports wizard allows you to create two types of reports for a list of entity instances:

  1. Report for manually selected instances of a particular entity

  2. Report for entity instances filtered by a certain request.

Let us have a look at the first report type. Let us assume we want to obtain a list of all book instances in the library (library$BookInstance entity) with titles and library departments they belong to.

At the first stage, we specify the report details:

  • Entity – report entity – library$BookInstance.

  • Template type – output format – XSLX.

  • Report name – report name – Book items location.

After that, select the type of the report (Report for list of entities) and click Next.

list of entities step 1
Figure 11. Report for a List of Entities: step 1

As per the task, we select BookItem.Publication.Book.Name and BookItem.LibraryDepartment.Name in the attributes selection window.

list of entities attributes
Figure 12. Report for a List of Entities: select Entity Attributes

Click ОК and move to the second stage of report regions editing.

The report template for a list of entities restricted to have only one region that displays data in tabular form. Adding new regions is not allowed, but you can edit an existing set of data by clicking on the link with the list of attributes, or remove an existing region and recreate it.

In this case, we do not need to make any changes. Click NextSave to save the report. The report looks as follows in the report editor:

list of entities editor
Figure 13. Report data structure

Once the report is saved, you can run it through the generic report browser.

In addition, we can add a button to run the report from the book items browser, which can be opened by clicking the Show items button in the publications browser. In order to do this, we will set the multiselect attribute for the book instances table to true to be able to specify a set of records for the report and then declare a standard ListPrintFormAction:

<groupTable id="bookInstancesTable"
            multiselect="true"
                        ...>
    <actions>
        <action id="create" type="create"/>
                <!-- -->
        <action id="list" type="listPrintForm" caption="msg://printList"/>
    <columns>
        <!-- -->
    </columns>
    <rowsCount/>
    <buttonsPanel id="buttonsPanel"
                  alwaysVisible="true">
        <button id="createBtn" action="bookInstancesTable.create"/>
        <!-- -->
        <button id="listBtn" action="bookInstancesTable.list"/>
    </buttonsPanel>
</groupTable>

Then we should link the Book items location report with the book items browser. Open the report editor, switch to the Roles and Screens tab and add the library$BookInstance.browse screen from the screens dropdown to the table below:

list of entities screens
Figure 14. Add screen

Now the report can be run from the book items browser. To get the list of items in the report, go first to the Library → Accession Register screen and generate items for one of the books from the drop-down list. Then, go to the Library → Publications screen, select the book for which you’ve generated items before and click the Show items button. In the BookInstances screen select items for the report in the table and click the Print list button. Print selected option exports the selected items, Print all option prints all instances selected by the current filter.

list of entities running
Figure 15. Print selected

The output is as follows:

list of entities result
Figure 16. Report result