How to Create a Report¶
In the user interface, users can configure their own reports through an intuitive graphical report builder. However, you can also define your own static reports through YAML configuration and make them available to your users. You may, for example, want to display the number of tasks per priority.
The solution to this problem involves two simple steps:
- Firstly, you have to define which data need to be fetched and how they should be presented to the user in a data grid configuration.
- To make the created report accessible to your users, you have to create an entry in the application menu.
Configuring the Data Grid¶
Defining the report basically is the same as configuring any other data grid:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # src/AppBundle/Resources/config/oro/datagrids.yml
datagrids:
orocrm_report-tasks-by_priority:
source:
type: orm
query:
select:
- priority.label AS taskPriority
- COUNT(task) AS tasksCount
from:
- { table: AppBundle:TaskPriority, alias: priority }
join:
left:
- join: AppBundle:Task
alias: task
conditionType: WITH
condition: priority = task.priority
columns:
taskPriority:
label: Priority
tasksCount:
label: '# Tasks'
sorters:
columns:
taskPriority:
data_name: priority.label
tasksCount:
data_name: tasksCount
default:
taskPriority: ASC
filters:
columns:
taskPriority:
data_name: priority.label
tasksCount:
data_name: tasksCount
filter_by_having: true
|