Successfully!

Error!

The First Template

  • Last update:  2020-12-03

  • You will learn
    • Create Data Connection

    • Create Templates and Datasets

    • Make a Report


    Create Data Connection

    1) This article, aimed at first-time users of FineReport, contains basic illustrations on how to make a general report in the designer.

    2) Data connection is the first step in making a report. This is to connect the designer with databases so that data from a database can be directly extracted to the designer.

    3) FineReport designer supports to connect with multiple databases simultaneously, which allows users to aggregate data from multiple sources into a single report.

    I. Instructions

    1. Define Data Connection

    1) Go to FineReport designer and click Server -> Define Data Connection.

    2) Or click on the Define Data Connection button in the left-side panel. Both actions work the same.

     

    3) On the left side of the dialog opened, there shows some existing data connections, with the corresponding attributes displayed on the right.


    2. Test Connection

    1) Normally, the designer contains a data connection named "FRDemo" in place. This is used to connect built-in SQlite database located inside the FineReport installation folder. All report designs from Help Doc use datasheets from FineReport built-in database.

    2) Select FRDemo and click on Test Connection button. The connection is well established if it prompts a dialog indicating successfully connected.

     

    Create Templates and Datasets

    1) FineReport introduces the concept of templates. The report files are stored in the form of templates, which can be reused to greatly reduce the time of report development.

    2) Report development is a process of transforming data into value, and the first step is to create a new dataset.

    I. Instructions

    1. Create a General Report

    1) Click on File -> New General Report and create a new template.

    2) You can also click on 10.png in the above toolbar to do the same.

     

     

    2. Create a New Dataset

    Note: a dataset is a set of data extracted from the database via a data connection. The extracted data must be stored into the template as a dataset before it can be used to generate a report.

    1) Click on the 11.png button and select DB Query to open the dataset configuration window.

    2) Name the dataset as "test1".

     

    3) Click the drop-down list on the top left corner, choose "FRDemo" and the database tables it connected to will be displayed below.

     

     

    3. SQL Query

    1) Look for table Sales_Volume in the list and drag it into the right-side input field. Choose [SELECT *] when releasing the mouse key, and the following SQL query will be added.

    SELECT * FROM Sales_Volume

    6.GIF

    2) Add the below WHERE condition and filter the data with field Region. Then, click on 12.png below the input field and refresh the section to see the parameter p_area in the list.

    WHERE Region = '${p_area}'

    7.GIF 

    Note: '${p_area}' is a string-type dataset parameter in the condition, with "p_area" as its name. Please refer to Dataset parameter for more information on parameters.

    3) Click the preview button 13.png above the input field, in the opened dialog enter "East China" as the value of parameter p_area and click OK, then you can see all the data with Region equal to "East China".

    8.GIF 

    4) Close the preview window. Click OK in the dataset configuration window to complete the setup. The created datasets will be displayed in the list on the bottom left. You can expand all the data columns within a dataset by clicking the triangle button before it.

    9.GIF 

    Make a Report

    1) This article introduces how to make a general report with previously created datasets.

    2) In the last section, we have set parameters when creating datasets, and now you'll learn how to handle them using the built-in parameter pane.

    3) A report with a parameter pane will be created, and by interacting with widgets inside it, you can perform data filter freely. 

    I. Make a Simple Detailed Table

    1. Enter the Headers

    Double click on A1 to E1 and input texts as the headers.

    1.png 

     

    2. Drag and Drop Data Columns

    Click on the triangle before "test1" to expand all the data columns. Drag and drop the needed columns to the corresponding cells. For more information on how to insert a data column, please refer to Insert data column.

    2.GIF 

     

    3. Styles

     Select cells from A1 to E2 to add black borders (inside and external). Set the text alignment to "Center".

    3.GIF 


    4. Save and Preview the Report

    1) Click on the "Save" button on the top left to save the template into the default path.

    4.GIF 

    2) Once saved, click on the "Preview" button next to it to preview the page.

    5.GIF  

    II. Make a Slightly Complex Report

    1. Clear Contents

    Select A1 to E2 and right-click -> Clear -> All.

    6.GIF 

     

    2. Report Styles

    1) Merge A1 to D2. Type in "Reginal Sale". Adjust font size and set the text alignment to Center, then add external borders.

    7.GIF 

    2) Select A3 to D6 and add inside and external borders.

    8.GIF 

    3) Merge A3 to B4, click Insert -> Cell Element -> Insert Slash, and type in "Product | Sales | Region". You can refer to Insert slope lines for more information on inserting slashes

     

    4) Merge D3 and D4, A6 and B6. Enter "Total" into both merged cells. Adjust font size and set the text alignment to Center.

    11.png 

     

    3. Insert Data into the Designed Report

    1) Drag and drop column "Product_types" into C3. Click Cell Attribute -> Expand on the right panel, and set Expansion Direction as Horizontal. You can refer to Cell expansion for detailed information on cell expansion.

    12.png 

    2) For cell C4, drag column "Product" into it and set its Expansion Direction to Horizontal as well.

    13.png 

    3) Put column "Region" into A5 and set the direction to Vertical.

    14.png 

    4) Put column "Salesperson" into B5 and set the direction to Vertical.

    15.png 

    5) Drag and drop column "Sales_volume" into C5, with Expansion Direction as No Expansion.

    16.png 

     

    4. Insert Formula

    1) Right-click on D5, D6 and C6, click Cell Element -> Insert Formula, and enter "SUM(C5)" into the opened window.

    17.GIF 

    2) Set the text alignment in A3 to D6 to Center.

    18.GIF 

     

    5. Parameter Pane Design

    In most cases, users simply need to view the data that meet certain conditions, among the huge volume of raw data. At this time, a pane is designed to assist data filtering.

    This section will focus on how to implement data filtering/querying with Parameter Pane. For more information on building the pane, please refer to Parameter application.

    1) Configure the parameter pane

    Click on the edit button to configure the parameter pane. All available widgets will be placed in the toolbar above.

    19.GIF 

    2) Drag and drop a Lable Widget into the pane, and modify its Widget Value to "Region" in the right-side panel.

    20.GIF 

    3) Drag a Drop-down Box into the pane and modify its Component Name to "p_area" ( make it the same as the parameter from the dataset).

    21.GIF 

    Click on the button after Data Dictionary to configure the data dictionary.

    22.GIF 

    Set the respective field values as below and click OK.

    23.png 

    4) Click on the right-most button in the toolbar to expand the Predefined Widget list, and put the Query Button into the pane.

    24.GIF 

     

    6. Filter Data Using Parameter Pane

    Save and preview. Now in browsers, you can filter data using the parameter pane. Choose "East China" In the drop-down box and click on Query to see the sales data of the East China area. Choose "North China" to bring out sales data of North China.

    25.GIF 

     

    Download template

    First Normal Report.cpt


    Attachment List


    Theme: Report Application
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback