Reporting needs

A company needs to make an employee information table, requiring that it can display the information of the department and all the employees in the department, and can query the department information conditionally;

Effect of the report

Report Design process

First of all, we need to choose a suitable report tool. Here, building block report platform is used for design. The specific steps are as follows:

1. Data preparation

Create two tables in the database, one named “ZHIwu” to store department information. A table named “User” is used to store customer information data. The relationship between the two tables is as follows: the “b_id” of the “user” table corresponds to the “ID” of the “ZHIwu” table.

Zhiwu table

The user table

2. Design the master table dataset

The main table displays department information, and the design steps are as follows:

  • Create a data set that can show the department information, input the report SQL, and join the parameters;
Remark:1When the browser searches, both the primary table and the sub-table can use "department ID" as the parameter to search, so we can write the parameter of the Mosaic as ID ='${pid}'After the browser address can be spliced? pid=1This form;2Pid in the following figure is randomly defined and used for browser parameter transmission.Copy the code

Browser lookup styles:

  • Because department information only shows one data on the page, remove the check box of “List or not” in Figure 1;
3. Design subtable data sets

The sub-table shows the information of employees in the department. The design steps are as follows:

  • Create a data set that can show the information of department employees, input the report SQL, and join the parameters;
Remark:1When the browser searches, "department ID" is used as a parameter to search, so we can write the parameter b_id='${pid}'After the browser address can be spliced? pid=1This form;2Pid in the following figure is randomly defined and used for browser parameter transmission.Copy the code

  • Since only one data is displayed on the page for department information, check “List or not” in Figure 2.
4. Template design

Design interface styles and drag data sets into cells;

5. Check the

Input parameters in the browser, the master and child table data changes with the parameters;