Download the latest version of FastReport.Net

FastReport.Net online ordering hot ongoing, instant can enjoy special offers! Click this link to buy it quickly!!

Sometimes we have to process data from different sources in different formats. This can be a headache for analysts and report developers. After all, you have to combine the data somehow. Fortunately, you can create many data connections in FastReport.Net reports. Also, data sources can be completely different – text files, databases. Thanks to this, we will be able to consolidate data in one report. In this article, we’ll show you how to create two data sources in a report and link tables from them to create a report that contains both primary and dependent tables. There are only two tables and two files. The first is in CSV format and the second is JSON.

Plug-ins are provided for the FastReport.Net report designer. They are extensions that add new functionality. These can be additional connectors for data sources or other controls for reports. In our example, we need to connect to JSON. Therefore, we will add a plug-in with a connector to the JSON file’s data source.

The plug-in

To get the jSON-formatted plug-in connector, we need to build the corresponding project. It is located here:

C: Program Files (x86) \ FastReports \ FastReport.Net \ Extras \ Connections \ fastreport.json

You just need to restore a NuGet newtonsoft.json package and build a project. In the Debug or Release folder, you’ll find two libraries: Fastreport.json. DLL and newtonsoft.json.dll. The first is a plug-in for report Designer.

How to Add plug-ins

Run report Designer. In the file menu, we find options. In the Report Designer option, go to the plugin TAB:

And add the plug-in we created. To use it, you need to restart the report Designer.

Let’s start by creating a presentation report. Use the button to create a new data source:

In a New window of the Data Source Creation wizard, click the “New Connection” button…

In the Connection Settings window, select the connection type. From this particular list, we select the new connections to add. We add them using plug-ins. Now we are interested in the standard link-CSV database. Select it and set the path to the data file:

As you can see, there are some more important connection Settings in this window. In the following window, you can see what the table looks like. Click OK, and proceed to the next step of the Data Source wizard. Here, you just mark the table with tags and complete the source creation.

Let’s create a second data source. This time we choose the connection type –JSON database.

From the Settings here we only have file selection. Also, as in the first case, select the table and complete the creation of the data source.

So, we have two tables – order and customer. In the Orders table, there is an external link to Customers.

Our task is to come up with customer names and a list of orders for each customer. In this way, you can get groups of customers’ orders. This type of report is called master-detail. To implement our plan, you need to create relationships between tables. In the Data window, click the Actions button. In the drop-down list, select New Relation… :

In the relationship editing window, we set up the parent table, which has a one-to-many relationship. We also set up child tables. The next step is to set up the communication column. In short, we select the foreign key in the parent table and the primary key in the child table:

You can see that the tables are associated with this characteristic element in the data tree:

The Customers element has been added to the Orders table and can be opened by clicking the plus sign. This means that the Orders table has the detailed Customers table. There’s no limit to how many details you can have.

Prepare data; You can create a report template. Drag the required fields from the Customers table into the “Data” section. For our example, the CompanyName field is sufficient. Then we right-click the “Data” area and select “Add Detail Data Band/ Add Detail Data Band” from the context menu.

Therefore, we add the subordinate band “Data”. Drag the required fields from the Orders table to the added band.

Add a detailed data tape.

We made the report template and ran the report in preview mode:

As a result, we get logically related tables from completely different data sources. As a result, you don’t need to convert the data into a single format, which makes it much easier to develop reports to people who often use a variety of data.


Related links:

  • Download the latest trial version of Fastrepot.net
  • Fastreport Chinese website
  • FastReport’s latest Chinese user manual is on the line, please download it!!