Reports - Creatio

57
Reports Version 8.0

Transcript of Reports - Creatio

ReportsVersion 8.0

This documentation is provided under restrictions on use and are protected by intellectual property laws. Except asexpressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate,broadcast, modify, license, transmit, distribute, exhibit, perform, publish or display any part, in any form, or by anymeans. Reverse engineering, disassembly, or decompilation of this documentation, unless required by law forinteroperability, is prohibited.

The information contained herein is subject to change without notice and is not warranted to be error-free. If youfind any errors, please report them to us in writing.

© 2022 Creatio. All rights reserved.

4

4

6

7

7

8

15

15

15

29

30

33

36

37

37

37

46

47

47

56

Table of Contents

MS Word reports

Basic macros

Custom macros

Transferring the package to another development environment

Create MS Word report using basic macros

Case implementation algorithm

Create MS Word report using custom macros

Source code

Case implementation algorithm

FastReport reports

The Report setup section interface

Algorithm of creating a report

Multilingual interface elements in reports

Transferring the package to another development environment

Create the FastReport report

Example implementation algorithm

Report by several records in a section

Create the FastReport report with an image

Example implementation algorithm

Report by several records in a section

Table of Contents | 3

© 2022 Creatio. All rights reserved.

MS Word reports Easy

Users can create MS Word reports in Creatio and configure them using the Creatio MS Word Report Designerplug-in. Learn more about creating and setting up MS Word reports in the "Set up MS Word reports" article.

Use macros to set up extra data output options for an MS Word report. You can use basic macros and createcustom macros.

Basic macrosThe general procedure of creating an MS Word report using basic macros is as follows:

The structure of macros in MS Word reports

The [#Date#] macroConverts a date to a specified date format. The default date format is " dd.MM.yyyy ". If the date format is notspecified, the entered date value will be converted to the default format. A detailed description of date formats isavailable in the Microsoft documentation. The argument is optional.

Examples:

If the entered value is " 07/15/2020 11:48:24 AM ", the macro will return " 15.07.2020 ".

Install the MS Word Report Designer plug-in. This is a one-time procedure. Learn more in the "Installing Creatioplug-in for MS Word" article.

1.

Add a new report record in the [ Report setup ] section.2.

Set up the report display parameters3.

Set up the report data fields and tables. Add a tag with the name of the macro in the [#MacrosName#] formatto the column when setting up column fields.

4.

Set up the report template layout in the Creatio MS Word Report Designer plug-in and upload the template toCreatio.

5.

ColumnName[#Macro name|Arguments#]

ColumnName[#Date#]

ColumnName[#Date|MM/dd/yyyy#]

MS Word reports | 4

© 2022 Creatio. All rights reserved.

If the entered value is " 31/01/2019 08:25:48 AM ", the macro will return " 01/31/2019 ".

The [#Lower#] macroConverts the value of a string to lowercase. The macro has no arguments.

An example:

If the entered value is " ExaMpLe ", the macro will return " example ".

The [#Upper#] macroConverts the value of a string to uppercase. The argument is optional. If the " FirstChar " argument is passed tothe macro, only the first character in the string will be converted to uppercase.

Examples:

If the entered value is " example ", the macro will return " EXAMPLE ".

If the entered value is " example ", the macro will return " Example ".

The [#NumberDigit#] macroConvert a raw number to a number with digit group separators. The default delimiter is the space character. Theargument is optional.

Examples:

If the entered value is " 345566777888.567 ", the macro will return " 345 566 777 888.567 ".

If the entered value is " 345566777888.567 ", the macro will return " 345,566,777,888.567 ".

ColumnName[#Lower#]

ColumnName[#Upper#]

ColumnName[#Upper|FirstChar#]

ColumnName[#NumberDigit#]

ColumnName[#NumberDigit|,#]

MS Word reports | 5

© 2022 Creatio. All rights reserved.

Note. If the fractional part of the number equals zero, only the integer part will be returned. If the enteredvalue is " 345566777888.000 ", the macro will return " 345,566,777,888 ".

The [#Boolean#] macroConverts a boolean value to a custom representation. The argument is required. The following arguments areavailable:

Examples:

If the column contains the true value, the macro will return " ☑ ".

If the column contains the true value, the macro will return " Yes ".

Custom macrosThe [ Report setup ] section enables users to create MS Word reports using Creatio tools and configure themusing the Creatio MS Word Report Designer plug-in. Learn more about creating and setting up MS Word reportsin the "Set up MS Word reports" article.

The general procedure of creating an MS Word report using custom macros is as follows:

A macro for setting up an MS Word report is a class implementing the IExpressionConverter interface (see the ExpressionConverterHelper schema of the NUI package).

To make a custom macro callable from the report template, mark the macro with the ExpressionConverterAttribute attribute containing the name of the macro. For example:

CheckBox – converts the entered value to " ☑ " or " ☐ ".

Yes,No – converts the entered value to " Yes " or " No ".

ColumnName[#Boolean|CheckBox#]

ColumnName[#Boolean|Yes,No#]

Install the MS Word Report Designer plug-in. This is a one-time procedure. Learn more in the "Installing Creatioplug-in for MS Word" article.

1.

Add a new report record in the [ Report setup ] section.2.

Set up the report display parameters3.

Implement custom macros.4.

Set up the report data fields and tables.5.

Set up the report template layout in the Creatio MS Word Report Designer plug-in and upload the template toCreatio.

6.

MS Word reports | 6

© 2022 Creatio. All rights reserved.

The Evaluate(object value, string arguments = "") interface method must be implemented in the class. Themethod accepts an MS Word report template field value as an argument and returns the string type value thatwill be inserted instead of this field in the ready MS Word report.

The general procedure of creating a custom MS Word report macro is as follows:

Transferring the package to another developmentenvironmentTo transfer the package with the report to another development environment, go to the [ Configuration ] section-> the [ Data ] tab and bind the data of the following elements:

Note. You can view the record Id in the database table even if you do not have access to the database. Todo this, display the Id system column in the window of binding data to packages.

Create MS Word report using basic macros Easy

Case. Create an "Account Info" report for the [ Accounts ] section edit page to display the followinginformation about the account:

[ExpressionConverterAttribute("CurrentUser")]

Create a new report in the [ Report setup ] section.1.

Set up the report display parameters.2.

Set up the report data fields and tables.3.

Add the [ Id ] column to the list of report columns that will be the incoming parameter for the custom macro.4.

Add a schema of the [ Source Code ] type with a class implementing the IExpressionConverter interface to thecustom package. The class must be marked by the ExpressionConverterAttribute attribute with the name ofthe macro. Implement the Evaluate(object value, string arguments = "") method in it.

5.

Publish the [ Source Code ] type object schema.6.

Add a tag with the name of the custom macro in the [#MacrosName#] format to the [ Id ] column when settingup column fields.

7.

SysModuleReport_ReportName – the report. To bind it, use the report Id from the [ dbo.SysModuleReport ]database table.

SysModuleReportTable_ReportName – the tabular component of the report. To bind it, use the report Id from the[ dbo.SysModuleReportTable ] database table.

[ Name ].

Create MS Word report using basic macros | 7

© 2022 Creatio. All rights reserved.

Case implementation algorithm

1. Create a new reportTo do this:

2. Set up the report display parametersSet the following values in the parameter setup area (2):

MS Word report setup page

[ Type ].

[ Primary contact ].

Open the System Designer by clicking . In the [ System setup ] block, click the [ Report setup ] link.1.

Click [ New report ] –> [ MS Word ].2.

[ Report title ] – "Account Info".

[ Section ] – "Accounts".

[ Show in the section list view ].

[ Show in the section record page ].

Create MS Word report using basic macros | 8

© 2022 Creatio. All rights reserved.

Setting up the report display parameters

Create MS Word report using basic macros | 9

© 2022 Creatio. All rights reserved.

3. Set up the report fieldsIn the [ Set up report data ] block of the section working area (5), set up the fields to display in the report. To dothis, click and select the [ Name ] column in the drop-down [ Column ] list. A macro will be added to the columnlater.

Click [ Select ].

Using the same method, add the [ Type ] and [ Primary contact ] columns to the template.

The list of columns after this step is presented below.

4. Add the macro tag to the column nameChange the [ Name ] column property. To do this, take the following steps;

In the [ Set up report data ] block of the section working area (5), double-click the title of the [ Name ] column1.

Create MS Word report using basic macros | 10

© 2022 Creatio. All rights reserved.

The list of columns after adding macro tags is presented below .

Click [ Save ].

5. Set up the report template layout and upload the template to CreatioTo set up the template:

or click in the column title bar.

Change the [Name] value of the [ Title ] field to [Name[#Upper#]] .

Click [ Save ].

2.

Open any MS Word file.1.

Click [ Connect ] on the Creatio plug-in toolbar.2.

Enter the username and password of the Creatio user. Click next to the [ Server ] field.3.

Create MS Word report using basic macros | 11

© 2022 Creatio. All rights reserved.

Click [ New ]. Enter the server parameters.

Click [ OK ].

4.

Click [ Select report ] on the Creatio plug-in toolbar.5.

Select the "Account info" report and click [ OK ].6.

Create MS Word report using basic macros | 12

© 2022 Creatio. All rights reserved.

The report setup window looks as follows:

Create MS Word report using basic macros | 13

© 2022 Creatio. All rights reserved.

As a result, the "Account Info" report will be available in the [ Accounts ] section list under [ Print ].

The report looks as follows.

Set up the template layout. Learn more about setting up a report template in the "Design report layout via theCreatio MS Word plug-in" article.After the setup, the report looks as follows:

7.

Click [ Save to Creatio ] to load the report template in Creatio.8.

Create MS Word report using basic macros | 14

© 2022 Creatio. All rights reserved.

Create MS Word report using custommacros

Advanced

Case. Create an "Account Summary" report for the [ Accounts ] section edit page to display the followinginformation about the account:

The report must contain information about the date of creation and the name of the employee who createdit.

Source codeYou can download the package with an implementation of the case using the following link.

Case implementation algorithm

1. Create a new reportTo do this:

[ Name ].

[ Type ].

[ Primary contact ].

[ Additional info ]. The annual revenue should be displayed for [ Customer ] accounts and the number ofemployees for [ Partner ] accounts.

Open the System Designer by clicking . In the [ System setup ] block, click the [ Report setup ] link.1.

Click [ New report ] —>[ MS Word ].2.

Create MS Word report using custom macros | 15

© 2022 Creatio. All rights reserved.

2. Set up the report display parametersSet the following values in the parameter setup area (2):

MS Word report setup page

[ Report title ] – "Account Summary".

[ Section ] – "Accounts”.

[ Show in the section list view ].

[ Show in the section record page ].

Create MS Word report using custom macros | 16

© 2022 Creatio. All rights reserved.

Setting up the report display parameters

Create MS Word report using custom macros | 17

© 2022 Creatio. All rights reserved.

3. Implement custom macrosGo to the [Advanced settings] section –> [ Configuration ] –> Custom package –> the [ Schemas ] tab. Click[ Add ] —> [ Source Code ]. Learn more about creating a schema of the [ Source Code ] type in the Create the[ Source code ] schema" article.

Specify the following parameters for the created object schema:

Implement a macro class for receiving additional information depending on the account type. The completesource code of the module is available below:

[ Title ] – "AccountInfoByTypeConverter".

[ Name ] – "UsrAccountInfoByTypeConverter".

namespace Terrasoft.Configuration{ using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Data; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Web; using System.ServiceModel.Activation; using System.Text;

Create MS Word report using custom macros | 18

© 2022 Creatio. All rights reserved.

using System.Text.RegularExpressions; using System.Web; using Terrasoft.Common; using Terrasoft.Core; using Terrasoft.Core.DB; using Terrasoft.Core.Entities; using Terrasoft.Core.Packages; using Terrasoft.Core.Factories;

// An attribute with the [AccountInfoByType] macro name. [ExpressionConverterAttribute("AccountInfoByType")] // The class should implement the IExpressionConverter interface. class AccountInfoByTypeConverter : IExpressionConverter { private UserConnection _userConnection; private string _customerAdditional; private string _partnerAdditional; // Calling localizable string values private void SetResources() { string sourceCodeName = "UsrAccountInfoByTypeConverter"; _customerAdditional = new LocalizableString(_userConnection.ResourceStorage, sourceCodeName, "LocalizableStrings.CustomerAdditional.Value"); _partnerAdditional = new LocalizableString(_userConnection.ResourceStorage, sourceCodeName, "LocalizableStrings.PartnerAdditional.Value"); } // Implementing the Evaluate method of the IExpressionConverter interface. public string Evaluate(object value, string arguments = "") { try { _userConnection = (UserConnection)HttpContext.Current.Session["UserConnection"]; Guid accountId = new Guid(value.ToString()); return getAccountInfo(accountId); } catch (Exception err) { return err.Message; } } // The method for receiving additional information depending on the account type. // As the Id input parameter of the account. private string getAccountInfo(Guid accountId) { SetResources(); try { // Creating an EntitySchemaQuery class instance with the [Account] root schema. EntitySchemaQuery esq = new EntitySchemaQuery(_userConnection.EntitySchemaManager, "Account"); // Adding the [Name] column from the [Type] lookup field.

Create MS Word report using custom macros | 19

© 2022 Creatio. All rights reserved.

Populate the localizable strings of the report with the following values:

Setting up the localizable strings

Name English (United States) Russian (Russia)

PartnerAdditional Number of employees {0} persons Number of employees {0} people

var columnType = esq.AddColumn("Type.Name").Name; // Adding the [Name] column from the [EmployeesNumber] lookup field. var columnNumber = esq.AddColumn("EmployeesNumber.Name").Name; // Adding the [Name] column from the [AnnualRevenue] lookup field. var columnRevenue = esq.AddColumn("AnnualRevenue.Name").Name; // The records are filtered by the account Id. var accountFilter = esq.CreateFilterWithParameters( FilterComparisonType.Equal, "Id", accountId ); esq.Filters.Add(accountFilter); // Retrieving an entity collection. EntityCollection entities = esq.GetEntityCollection(_userConnection); // If the collection is not empty, the method will return the corresponding // data depending on the account if (entities.Count > 0) { Entity entity = entities[0]; var type = entity.GetTypedColumnValue(columnType); switch (type) { case "Customer": return String.Format(_customerAdditional, entity.GetTypedColumnValue case "Partner": return String.Format(_partnerAdditional, entity.GetTypedColumnValue(columnNumber)); default: return String.Empty; } } return String.Empty; } catch (Exception err) { throw err; } } }}

Create MS Word report using custom macros | 20

© 2022 Creatio. All rights reserved.

CustomerAdditional Annual turnover {0} Annual revenue {0}

After making changes, save and publish the schema.

Go to the [ Advanced settings ] section –> [ Configuration ] –> Custom package –> the [ Schemas ] tab. Click[ Add ] —> [ Source Code ].

Specify the following parameters for the created object schema:

Implement a macro class for retrieving the current date. The complete source code of the module is availablebelow:

[ Title ] – "CurrentDateConverter".

[ Name ] – "UsrCurrentDateConverter".

namespace Terrasoft.Configuration{ using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Data; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Web; using System.ServiceModel.Activation; using System.Text; using System.Text.RegularExpressions; using System.Web; using Terrasoft.Common; using Terrasoft.Core; using Terrasoft.Core.DB; using Terrasoft.Core.Entities; using Terrasoft.Core.Packages; using Terrasoft.Core.Factories;

// An attribute with the [CurrentDate] macro name. [ExpressionConverterAttribute("CurrentDate")] // The class should implement the IExpressionConverter interface. class CurrentDateConverter : IExpressionConverter

Create MS Word report using custom macros | 21

© 2022 Creatio. All rights reserved.

After making changes, save and publish the schema.

Go to the [ Advanced settings ] section –> [ Configuration ] –> Custom package –> the [ Schemas ] tab. Click[ Add ] —> [ Source Code ].

Specify the following parameters for the created object schema:

Implement a macro class for retrieving the current user. The complete source code of the module is availablebelow:

class CurrentDateConverter : IExpressionConverter { private UserConnection _userConnection;

// Implementing the Evaluate method of the IExpressionConverter interface. public string Evaluate(object value, string arguments = "") { try { _userConnection = (UserConnection)HttpContext.Current.Session["UserConnection"]; // The method returns the current date. return _userConnection.CurrentUser.GetCurrentDateTime().Date.ToString("dd MMM yyyy"); } catch (Exception err) { return err.Message; } } }}

[ Title ] – "CurrentUserConverter"

[ Name ] – "UsrCurrentUserConverter".

namespace Terrasoft.Configuration{ using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Data;

Create MS Word report using custom macros | 22

© 2022 Creatio. All rights reserved.

After making changes, save and publish the schema.

4. Set up the report fieldsIn the [ Set up report data ] block of the section working area (5), set up the fields to display in the report. To dothis, click and select the [ Id ] column in the drop-down [ Column ] list. The current [ Id ] column will later beused in the custom macro to retrieve the current date.

Attention. Use the [ Id ] column as an input parameter for a custom macro.

using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Web; using System.ServiceModel.Activation; using System.Text; using System.Text.RegularExpressions; using System.Web; using Terrasoft.Common; using Terrasoft.Core; using Terrasoft.Core.DB; using Terrasoft.Core.Entities; using Terrasoft.Core.Packages; using Terrasoft.Core.Factories;

// An attribute with the [CurrentUser] macro name. [ExpressionConverterAttribute("CurrentUser")] // The class should implement the IExpressionConverter interface. class CurrentUserConverter : IExpressionConverter { private UserConnection _userConnection; // Implementing the Evaluate method of the IExpressionConverter interface. public string Evaluate(object value, string arguments = "") { try { _userConnection = (UserConnection)HttpContext.Current.Session["UserConnection"]; // The method returns the contact of the current user. return _userConnection.CurrentUser.ContactName; } catch (Exception err) { return err.Message; } } }}

Create MS Word report using custom macros | 23

© 2022 Creatio. All rights reserved.

Click [ Select ].

Use the same procedure to add [ Id ] (the column will later be used in the custom macro for retrieving thecurrent user), [ Name ], [ Type ], [ Primary contact ], and [ Id ] (the column will later be used in the custommacro for receiving additional information depending on the account type) to the column template.

The list of columns after this step is presented below.

5. Attach custom macro tags to the column names

Create MS Word report using custom macros | 24

© 2022 Creatio. All rights reserved.

Attention. First, publish the [ Source Code ] type schema that implements a custom macro must. Then,add the name of the macro to the template layout. If you refresh the page in Creatio, the macro will not beprinted.

Change the property of the [ Id ] column of an [ Account ] object. To do this, take the following steps:

Use the same procedure to add more custom macro tags to the names of other [ Id ] columns.

The list of columns after adding custom macro tags is presented below.

Click [ Save ].

In the [ Set up report data ] block of the section working area (5), double-click the title of the [ Id ] column orclick in the column title bar.

1.

Change the [Id] value of the [ Title ] field to [Id[#CurrentDate#]] . [#CurrentDate#] is a the custom macrotag for retrieving the current date.

Click [ Save ].

2.

[#CurrentUser]# – for receiving the current user.

[#AccountInfoByType#] – for receiving additional information depending on the account type.

Create MS Word report using custom macros | 25

© 2022 Creatio. All rights reserved.

6. Set up the report template layout and upload the template to CreatioTo set up the template:

Open any MS Word file.1.

Click [ Connect ] on the Creatio plug-in toolbar.2.

Enter the username and password of the Creatio user. Click next to the [ Server ] field.3.

Click [ New ]. Enter the server parameters.

Click [ OK ].

4.

Click [ Select report ] on the Creatio plug-in toolbar.5.

Select the "Account summary" and click [ OK ].6.

Create MS Word report using custom macros | 26

© 2022 Creatio. All rights reserved.

The report setup window looks as follows:

Create MS Word report using custom macros | 27

© 2022 Creatio. All rights reserved.

As a result, the "Account Summary" report will be available on the contact page under [ Print ].

Set up the template layout. Learn more about setting up a report template in the "Design report layout via theCreatio MS Word plug-in" article.

After the setup, the report looks as follows:

7.

Click [ Save to Creatio ] to load the configured report template in Creatio.8.

Create MS Word report using custom macros | 28

© 2022 Creatio. All rights reserved.

A report for accounts of the [ Customer ] type looks as follows.

A report for accounts of the [ Partner ] type looks as follows.

FastReport reports Easy

The [ Report setup ] section enables users to create reports using the Creatio tools and configure such reportsusing the FastReport Designer.

Attention. You can set up custom reports using Creatio version 7.15.3 and up.

To open the [ Report setup ] section:

Open the System Designer by clicking .1.

In the [ System setup ] block, select the [ Report setup ] link.2.

FastReport reports | 29

© 2022 Creatio. All rights reserved.

The [ Report setup ] section interfaceThe report setup section page will open. The page contains the following elements:

The [ Close ] button – closes the report setup section.

The [ New report ] button – selects the type of report to add ( FastReport or MS Word ).

The [ Delete ] button – removes the selected report from the section list. The button appears when you selectan existing report.

The [ Search ] string – performs the search of a report by name.

FastReport reports | 30

© 2022 Creatio. All rights reserved.

Selecting the [ FastReport ] option, a report setup page will open. The page contains several functional areas withthe tools to create and set up a report.

ToolbarThe Toolbar (1) has the following buttons:

FastReport reports | 31

© 2022 Creatio. All rights reserved.

The setup area of display parametersThe setup area of display parameters (2) includes the following elements:

Note. Standard filters are implemented in the SimpleReportFilterPage filtering page schema. After youselect a report from the drop-down list of the [ Reports ] button in the section dashboard view, you will seea page where you can specify the following report parameters:

The information [ Note ] areaThe [ Note ] area (3) contains a short instruction on how to set up the reports.

Working areaUse the working area of the report setup page (4) to set up your report. The report setup working area containsthe flowing elements:

[ Apply ] – saves the created report.

[ Cancel ] – closes the report setup without saving the changes.

The [ Report title ] field – sets the name for the report. Depending on your settings, the report name willdisplay in the menu of the [ Print ] button in a section or on a record page, as well as in the [ Reports ] buttondrop-down list of a section in the dashboard view.

The [ Section ] field – a drop-down list of sections that you can select for generating your report.

The [ Show on the section list review ] checkbox – determines whether the report displays in the drop-downlist of the [ Print ] button in a section.

The [ Show on the section record page ] checkbox – determines whether the report displays in the drop-downlist of the [ Print ] button on a page of a section record.

The [ Show in the section analytics view ] checkbox – determines whether the report displays in the drop-downlist of the [ Reports ] button in the section dashboard view. In this case, you can use a custom page ofadditional filtering. Set the filtering parameters using a schema. Specify this schema in the [ Filter page ] field.To set the filtering parameters, select a report (click the [ Reports ] button in the section dashboard view andselect the report from the drop-down list).

The [ Filter page ] field – a drop-down list of pages with filters. The field only appears if you select the [ Show inthe section analytics view ] checkbox. You can select the SimpleReportFilterPage standard filtering page orcreate a custom filtering page and specify the BaseReportFilterPage schema as its parent schema.

[ Selected records ].

[ Filtered records in list ].

[ All records in list ].

The [ Specify data sources for the report ] block – use it to enter the sources of data for your report and setlocalizable strings in the json format.

The [ Download file with data sources to design a report in the FastReport Designer ] – use it to download the

FastReport reports | 32

© 2022 Creatio. All rights reserved.

Algorithm of creating a report

Installing the FastReport Designer

Note. You will need the following components to work with the Report Designer:

To install the FastReport Designer, use the following link and download the zip archive.

Creating a new reportTo create a new report:

Specifying the report data sourcesIn the [ Specify data sources for the report ] block of the working area (4), specify the list of objects, theircolumns and connections that will be used to receive data. Specify the localizable strings if needed. Use the JSONformat. Example of providing a data source

Example of providing a data source

report template (a *.frx file). To do this, click the [ Download file ] button.

The [ Import a file with the report template ] block – use it to upload the template to Creatio after you set it upusing FastReport. To do this, click the [ Upload file ] button.

Install the FastReport Designer (you only perform it once).1.

Create a report in the [ Report setup ] section.2.

Specify the data sources for the report.3.

Create a report data provider that will implement processing of data logic.4.

Download the file with data sources and set it up in the FastReport Designer.5.

Upload the configured report template to Creatio.6.

Windows OS.1.

64-bit Microsoft .Net Framework 4.7.2.2.

Open the System Designer by clicking . In the [System setup] block, click the [ Report setup ] link.1.

Click [ New report ] —>[ FastReport ].2.

In the parameter setup area (2) specify the report title, the section for the report, the display parameters.3.

{ // Name of the data provider class. "ProviderName": "YourProviderName", // Table structure for the report template.

FastReport reports | 33

© 2022 Creatio. All rights reserved.

Note. The DataValueType parameter contains a value from the Terrasoft.core.enums.DataValueTypeenumeration.

Click [ Apply ] in the toolbar (1) to save the data.

Creating a report data providerThe report data provider is a custom class written in C#. To create the provider:

"Schemas": { // Name of the database table or virtual tables, whose columns need to be added to the report. "TableName1": { // Name of the column that needs to be added to the report. "ColumnName1": { // Column data type. "DataValueType": DataValueType1 }, "ColumnName2": { "DataValueType": DataValueType2 } }, "TableName2": { "ColumnName1": { "DataValueType": DataValueType1 }, "ColumnName2": { "DataValueType": DataValueType2 } }, // Report localizable strings. "LocalizableStrings": { // Name of the report localizable string. "LocalizableString1": { // Data type of the localizable string. "DataValueType": 1 }, "LocalizableString2": { "DataValueType": 1 } } }}

In the custom development package, create a [ Source Code ] type schema.1.

Create a service class in the schema source code. Use the Terrasoft.Configuration namespace or any of itsembedded namespaces. Mark the class with the [ DefaultBinding ] attribute containing the necessary

2.

FastReport reports | 34

© 2022 Creatio. All rights reserved.

Example of implementing the report data processing logic

parameters. The service class must be the inheritor of Terrasoft.Configuration.Reporting.FastReport.IFastReportDataSourceDataProvider .

Add the GetLocalizableStrings(UserConnection) method implementation to the class. The method implementslocalization of the report fields.

3.

Add the ExtractFilterFromParameters(UserConnection, Guid, IReadOnlyDictionary) method implementation tothe class. This method is responsible for adding the interface filters.

4.

Add the GetData(UserConnection, IReadOnlyDictionary) method implementation to the class. This methodmust return a Task<ReportDataDictionary> type value. Describe the logic of receiving the report data in themethod.

5.

Publish the source code schema.6.

namespace Terrasoft.Configuration{ using System.Collections.Generic; using System.Threading.Tasks; using Terrasoft.Configuration.Reporting.FastReport; using Terrasoft.Core; using Terrasoft.Core.Factories; // Name of the data provider class for the report, whose logic needs to be implemented. [DefaultBinding(typeof(IFastReportDataSourceDataProvider), Name = "YourProviderName")] public class YourProviderName : IFastReportDataSourceDataProvider { // The code for implementing the logic of getting data for the report. // Localization of the report strings. private IEnumerable<IReadOnlyDictionary<string, object>> GetLocalizableStrings(UserConnection userConnection) { var localizableStrings = _localizableStringNames.ToDictionary( x => x, x => (object)(new LocalizableString(userConnection.ResourceStorage, _resourceManagerName, $"LocalizableStrings.{x}.Value")).Value); return new[] { localizableStrings }; } // Adding the interface filters. private IEntitySchemaQueryFilterItem ExtractFilterFromParameters(UserConnection userConnection, Guid entitySchemaUId, IReadOnlyDictionary<string, object> parameters) { var managerItem = userConnection.EntitySchemaManager.GetItemByUId(entitySchemaUId); return parameters.ExtractEsqFilterFromReportParameters(userConnection, managerItem.Name) ?? throw new Exception(); } // Adding data to the report. public Task<ReportDataDictionary> GetData(UserConnection userConnection, IReadOnlyDictionary<string, object> parameters) { }

FastReport reports | 35

© 2022 Creatio. All rights reserved.

Setting up templates in the FastReport DesignerDownload the file with data sources. Click the [ Download file ] button in the [ Download file with data sources todesign a report in the FastReport Designer ] block (4) of the working area. The file must have the *.frxextension.

Double click the downloaded file to open it in FastReport and configure the template layout. Learn more aboutconfiguring the template in the FastReport documentation.

Note. The file saves the structure of the data source implemented in the [ Report setup ] section.

Attention. The FastReport Designer is a third party application. The template preview function is notavailable.

Uploading the configured template to CreatioClick the [ Upload template ] button in the [ Import a file with the report template ] block (4) of the working areato upload the prepared template to Creatio. After you upload the template, you can generate a report in thesection dashboard view or on a record page. You can specify this in the parameter setup area (2). The generatedreport will be saved in the pdf format.

Attention. The [ Print ] and [ Reports ] buttons display in corresponding sections and on record pages ifthere is at least one report configured and published for a specific section.

Multilingual interface elements in reportsThe [ Translations ] section in the System Designer enables setting the values of interface elements for amultilingual report. To find the previously localized strings of the report, use the Configuration:SchemaName key(e.g., Configuration:UsrContactDataSourceCode ). You can find a report field using the following key: Configuration:SchemaName:FieldName (e.g., Configuration:UsrContactDataSourceCode:LocalizableStrings.ReportTitle.Value ).

If the [ Show on the section list review ] and [ Show on the section record page ] checkboxes are selected,translate the report title. You can find the report title using the following key: Configuration: SchemaName:Caption(e.g., Configuration:UsrContactDataSourceCode:Caption ). If the [ Show in the section analytics view ] checkbox (2)is selected, translate the report title. You can find the report title using the following key: Data:SysModuleAnalyticsReport.Caption:FieldIdentificator (e.g., Data:SysModuleAnalyticsReport.Caption:d52e8b78-772b-77ee-3394-bdb3616d859a ).

Learn more about working with the [ Translations ] section in the article.

}}

FastReport reports | 36

© 2022 Creatio. All rights reserved.

Transferring the package to another developmentenvironmentTo transfer the package with the report to another environment, go to the [ Configuration ] section -> the [ Data] tab and bind the data of the following elements:

Note. You can view the record Id in the database table even if you do not have access to the database. Todo this, display the Id system column in the window of binding data to packages.

Create the FastReport report Medium

Example. Create a "Contact Data” base report that would display the following information about thecontacts:

Example implementation algorithm

1. Set up the report display parametersSpecify the following values for the created report in the parameter setup area (2):

FastReportTemplate_ReportName – the report template. To bind it, use the template Id from the[ dbo.FastReportDataSource ] database table.

FastReportDataSource_ReportName – the source of the report data. To bind it, use the source Id from the[dbo.FastReportDataSource] database table.

SysModuleReport_ReportName – the report. To bind it, use the report Id from the [ dbo.SysModuleReport ]database table.

[ Full name ];

[ Birthday ];

[ Gender ];

[ Account ].

[ Report title ] – "Contact Data”;

[ Section ] – "Contacts”;

[ Show in section ] – select the checkbox;

[ Show in card ] – select the checkbox;

[ Show in the section analytics view ] – select the checkbox;

[ Filter page ] – SimpleReportFilterPage.

Create the FastReport report | 37

© 2022 Creatio. All rights reserved.

Note. SimpleReportFilterPage – a client schema that implements standard simple filters.

The report setup page

Setting up the report display parameters

2. Specify the data sourcesIn the [ Specify data sources for the report ] block of the working area (4), add the code below:

Create the FastReport report | 38

© 2022 Creatio. All rights reserved.

ContactDataProviderContactDataProvider

Click [ Apply ] to save and apply the changes (1).

3. Create the report data providerGo to the [ Advanced settings ] section -> [ Configuration ] -> [ Custom package ] -> the [ Schemas ] tab. Click[ Add ] —> [ Source Code ].

Specify the following parameters for the created object schema:

The complete source code of the module is available below:

{ // Name of the data provider class. "ProviderName": "ContactDataProvider", "Schemas": { "ContactData": { "Full name": {"DataValueType": 1}, "Birthday": {"DataValueType": 1}, "Gender": {"DataValueType": 1}, "Account": {"DataValueType": 1} }, // Added for localization. "LocalizableStrings": { "ReportTitle": {"DataValueType": 1}, "FullNameLabel": {"DataValueType": 1}, "BirthdayLabel": {"DataValueType": 1}, "GenderLabel": {"DataValueType": 1}, "AccountLabel": {"DataValueType": 1} } }}

[ Title ] – "Contact Data";

[ Name ] – "UsrContactDataSourceCode".

Create the FastReport report | 39

© 2022 Creatio. All rights reserved.

ContactDataProviderContactDataProvider

namespace Terrasoft.Configuration{ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using Terrasoft.Common; using Terrasoft.Configuration.Reporting.FastReport; using Terrasoft.Core; using Terrasoft.Core.Entities; using Terrasoft.Core.Factories; using Terrasoft.Nui.ServiceModel.Extensions; using EntitySchema = Terrasoft.Core.Entities.EntitySchema; using EntitySchemaColumn = Terrasoft.Core.Entities.EntitySchemaColumn;

// Name of the data provider class for the report, whose logic needs to be implemented. [DefaultBinding(typeof(IFastReportDataSourceDataProvider), Name = "ContactDataProvider")] public class ContactDataProvider : IFastReportDataSourceDataProvider {

private Guid _entitySchemaUId = new Guid("16BE3651-8FE2-4159-8DD0-A803D4683DD3"); // Name of the source code schema. private readonly string _resourceManagerName = "UsrContactDataSourceCode"; private readonly string[] _localizableStringNames = new[] { "ReportTitle", "FullNameLabel", "BirthdayLabel", "GenderLabel", "AccountLabel" };

// Populating the report columns. private IEnumerable<IReadOnlyDictionary<string, object>> GetContactData( UserConnection userConnection, Guid entitySchemaUId, IEntitySchemaQueryFilterItem filter) { // Getting the object schema. var entitySchema = userConnection.EntitySchemaManager.GetInstanceByUId(entitySchemaUId); // Creating the object of the EntitySchemaQuery class. EntitySchemaQuery query = new EntitySchemaQuery(entitySchema); // Adding columns to query. query.AddColumn("Name"); query.AddColumn("BirthDate"); var gender = query.AddColumn("Gender.Name"); var account = query.AddColumn("Account.Name");

Create the FastReport report | 40

© 2022 Creatio. All rights reserved.

Populate the localizable strings of the report with the following values:

// Adding the created filter. query.Filters.Add(filter); // Getting the collection of contacts. var contacts = query.GetEntityCollection(userConnection); var contactsCollection = new Collection<Dictionary<string, object>>(); // Populating the report columns. foreach (var entity in contacts) { contactsCollection.Add(new Dictionary<string, object> { ["Full name"] = entity.GetTypedColumnValue<string>("Name"), ["Birthday"] = entity.GetTypedColumnValue<string>("BirthDate"), ["Gender"] = entity.GetTypedColumnValue<string>(gender.Name), ["Account"] = entity.GetTypedColumnValue<string>(account.Name) }); } return contactsCollection; } // Localization of the report title. private IEnumerable<IReadOnlyDictionary<string, object>> GetLocalizableStrings(UserConnection userConnection) { var localizableStrings = _localizableStringNames.ToDictionary( x => x, x => (object)(new LocalizableString(userConnection.ResourceStorage, _resourceManagerName, $ return new[] { localizableStrings }; } // Adding the interface filters. private IEntitySchemaQueryFilterItem ExtractFilterFromParameters(UserConnection userConnection, Guid entitySchemaUId, IReadOnlyDictionary<string, object> parameters) { var managerItem = userConnection.EntitySchemaManager.GetItemByUId(entitySchemaUId); return parameters.ExtractEsqFilterFromReportParameters(userConnection, managerItem.Name) ?? }

// Getting data. public Task<ReportDataDictionary> GetData(UserConnection userConnection, IReadOnlyDictionary< var filter = ExtractFilterFromParameters(userConnection, _entitySchemaUId, parameters); var result = new ReportDataDictionary { // Populating the report columns. ["ContactData"] = GetContactData(userConnection, _entitySchemaUId, filter), ["LocalizableStrings"] = GetLocalizableStrings(userConnection) }; return Task.FromResult(result); } }}

Create the FastReport report | 41

© 2022 Creatio. All rights reserved.

Setting up the localizable strings

Name English (United States)

ReportTitle Contact Data

FullNameLabel Full name

BirthdayLabel Birthday

GenderLabel Gender

AccountLabel Account

Publish the schema.

4. Download the template and set up its layout in FastReportDownload ContactData.frx . Click [ Download file ] in the [ Download file with data sources to design a report inthe FastReport Designer ] block (4) of the working area.

To open the template in the Report Designer:

Run the Terrasoft.Reporting.FastReport.Designer.exe file from the zip archive and open the FastReportdesigner.

1.

Click [ Open... ] in the window that pops up.2.

Create the FastReport report | 42

© 2022 Creatio. All rights reserved.

You can also open the report template from the [ File ] menu -> [ Open... ] or by pressing [ Ctrl+O ] keycombination.

Create the FastReport report | 43

© 2022 Creatio. All rights reserved.

Set up the template layout.

Navigate to the folder containing the downloaded report (usually, it is the “Downloads” folder), select the filewith the template and click [ Open ].

3.

Create the FastReport report | 44

© 2022 Creatio. All rights reserved.

5. Upload the configured report template to CreatioTo upload the ContactData.frx , file, click [ Upload template ] in the [ Import a file with the report template ] blockof the section working area (4). Confirm that the template has been uploaded successfully.

As a result, the "Contact Data” report will be available on the contact page under the [ Print ].

You can also find the report on the [ Contacts ] sectin dashboard view, under the [ Reports ] button.

The report is generated as per the selected [ Filtered records in list ] option in the filtering page. To upload thereport, click [ Create report ]. To close the filtering page and cancel generating the report, click [ Cancel ].

Create the FastReport report | 45

© 2022 Creatio. All rights reserved.

The report looks as follows:

Report by several records in a sectionTo receive the report with several records:

To include information from several section records to your report:

Enable the [ Show in section ] checkbox and select several records in the section list.1.

You can use the section filters or the filtering page with the [ Show in the section analytics view ] checkboxselected.

2.

Open the needed section.1.

Apply filters if needed.2.

Click [ Actions ] —> [ Select multiple records ].3.

Select the needed report in the [ Print ] button drop-down list.4.

Create the FastReport report | 46

© 2022 Creatio. All rights reserved.

The report looks as follows:

Create the FastReport report with an image Medium

Example. Create an "Account Info" report that would display the following information about the accounts:

Example implementation algorithm

[ Name ];

[ Logo ].

Create the FastReport report with an image | 47

© 2022 Creatio. All rights reserved.

1. Set up the report display parametersSet the following values in the parameter setup area:

Note. SimpleReportFilterPage – a client schema that implements standard simple filters.

The report setup page

Setting up the report display parameters

[ Report title ] – "Account Info".

[ Section ] – "Accounts".

[ Show in section ].

[ Show in card ].

[ Show in the section analytics view ].

[ Filter page ] – SimpleReportFilterPage.

Create the FastReport report with an image | 48

© 2022 Creatio. All rights reserved.

2. Specify the data sourcesIn the [ Specify data sources for the report ] block of the working area (4), add the code below:

AccountInfoProviderAccountInfoProvider

Click [ Apply ] to save and apply the changes (1).

{ // The name of the data provider class. "ProviderName": "AccountInfoProvider", "Schemas": { "Data": { "Name": { "DataValueType": 1 }, "Logo": { "DataValueType": 14 } }, // Added for localization. "LocalizableStrings": { "ReportTitle": {"DataValueType": 1}, "NameLabel": {"DataValueType": 1}, "LogoLabel": {"DataValueType": 1} } }}

Create the FastReport report with an image | 49

© 2022 Creatio. All rights reserved.

3. Create the report data providerGo to the [ Advanced settings ] section -> [ Configuration ] -> Custom package -> the [ Schemas ] tab. Click[ Add ] —> [ Source Code ]. Learn more about creating a schema of the [ Source Code ] type in the "Create the[ Source Code ] schema" article.

Specify the following parameters for the created object schema:

The complete source code of the module is available below:

ContactDataProviderContactDataProvider

[ Title ] – "Account Info";

[ Name ] – "UsrAccountInfoSourceCode".

namespace Terrasoft.Configuration{ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Terrasoft.Common; using Terrasoft.Configuration.Reporting.FastReport; using Terrasoft.Core; using Terrasoft.Core.Entities; using Terrasoft.Core.Factories;

// The name of the data provider class for the report, whose logic needs to be implemented. [DefaultBinding(typeof(IFastReportDataSourceDataProvider), Name = "AccountInfoProvider")] public class AccountInfoProvider : IFastReportDataSourceDataProvider { // The name of the schema with the source code. private readonly string _resourceManagerName = "UsrAccountInfoSourceCode"; private readonly string[] _localizableStringNames = new[] { "ReportTitle", "NameLabel", "LogoLabel" };

Create the FastReport report with an image | 50

© 2022 Creatio. All rights reserved.

Populate the localizable strings of the report with the following values:

Setting up the localizable strings

Name English (United States)

ReportTitle Account Info

// Populating columns in the report. private IEnumerable<IReadOnlyDictionary<string, object>> GetData(UserConnection userConnection, IEntitySchemaQueryFilterItem filter) { var esq = new EntitySchemaQuery(userConnection.EntitySchemaManager, "Account"); // Adding columns to the request. var nameColumn = esq.AddColumn("Name").OrderByDesc(); var logoColumn = esq.AddColumn("AccountLogo.Data"); // Adding the created filter. esq.Filters.Add(filter); return esq.GetEntityCollection(userConnection) .Select(x => new Dictionary<string, object> { ["Name"] = x.GetTypedColumnValue<string>(nameColumn.Name), ["Logo"] = x.GetStreamValue(logoColumn.Name)?.ToArray() }); } // Localization of the report title. private IEnumerable<IReadOnlyDictionary<string, object>> GetLocalizableStrings(UserConnection userConnection) { var localizableStrings = _localizableStringNames.ToDictionary( x => x, x => (object)(new LocalizableString(userConnection.ResourceStorage, _resourceManagerName, $"LocalizableStrings.{x}.Value")).Value); return new[] { localizableStrings }; }

// Adding the interface filters. private IEntitySchemaQueryFilterItem ExtractFilterFromParameters(UserConnection userConnection, IReadOnlyDictionary<string, object> parameters) { return parameters.ExtractEsqFilterFromReportParameters(userConnection, "Account") ?? throw new Exception(); }

// Receive data. public Task<ReportDataDictionary> GetData(UserConnection userConnection, IReadOnlyDictionary<string, object> parameters) { var filter = ExtractFilterFromParameters(userConnection, parameters); var result = new ReportDataDictionary { // Populate columns in the report. ["Data"] = GetData(userConnection, filter), ["LocalizableStrings"] = GetLocalizableStrings(userConnection) }; return Task.FromResult(result); } }}

Create the FastReport report with an image | 51

© 2022 Creatio. All rights reserved.

ReportTitle Account Info

NameLabel Name

LogoLabel Logo

Name English (United States)

Publish the schema.

4. Download the template and set up its layout in FastReportDownload the AccountInfo.frx file. Click [ Download file ] in the [ Download file with data sources to design areport in the FastReport Designer ] block (4) of the working area.

To open the template in the Report Designer:

Run the Terrasoft.Reporting.FastReport.Designer.exe file from the zip archive and open the FastReportdesigner.

1.

Click [ Open... ] in the window that pops up.2.

You can also open the report template from the [ File ] menu -> [ Open... ] or by pressing [ Ctrl+O ] key

Create the FastReport report with an image | 52

© 2022 Creatio. All rights reserved.

You can also open the report template from the [ File ] menu -> [ Open... ] or by pressing [ Ctrl+O ] keycombination.

Navigate to the folder containing the downloaded report (usually, it is the "Downloads" folder), select the filewith the template and click [ Open ].

3.

Create the FastReport report with an image | 53

© 2022 Creatio. All rights reserved.

Set up the template layout.

Attention. To display an image in the [ Logo ] column of the report, select Picture in the[ BindableControl ] field of the report designer when setting up the template.

5. Upload the configured report template to CreatioTo upload the AccountInfo.frx file, click [ Upload template ] in the [ Import a file with the report template ] blockof the section working area (4). Confirm that the template has been uploaded successfully.

As a result, the "Account Info" report will be available on the contact page under [ Print ].

Create the FastReport report with an image | 54

© 2022 Creatio. All rights reserved.

You can also find the report in the [ Accounts ] section dashboard view under [ Reports ].

The report is generated as per the selected [ Filtered records in list ] option on the filtering page. To upload thereport, click [ Create report ]. To close the filtering page and cancel generating the report, click [ Cancel ].

Create the FastReport report with an image | 55

© 2022 Creatio. All rights reserved.

The report looks as follows:

Report by several records in a sectionTo receive the report with several records:

To include information from several section records in your report:

Enable the [ Show in section ] checkbox and select several records in the section list.1.

You can use the section filters or the filtering page with the [ Show in the section analytics view ] checkboxselected.

2.

Open the needed section.1.

Apply filters if needed.2.

Click [ Actions ] —> [ Select multiple records ].3.

Select the needed report in the [ Print ] button drop-down list.4.

Create the FastReport report with an image | 56

© 2022 Creatio. All rights reserved.

The report looks as follows:

Create the FastReport report with an image | 57

© 2022 Creatio. All rights reserved.