The Pivot control needs data to work.
In the current version of the Pivot Reports module, data can only come from SQL queries targeting the current Dolibarr database.
You can add as many SQL queries as you want in the module's config page.
Each SQL query is treated as an independent data source and its name is displayed in the main module interface as the left menu.
Each SQL query already created can be disabled or deleted, it will no longer appear in the left menu of the module.
Data sources list
Add a Data source
Edit / Delete a Data source
Time fields naming conventions
Reordering Data sources in left menu
The list of Data sources is available in the module's config page, "Data Sources" tab.
The Pivot Reports module comes with 17 predefined data sources covering the majority of Dolibarr elements (Quote, Orders, ...).
Above the list of data sources, the button "New Data source" opens the dialog for creating a new SQL query.
The name of the data source is mandatory as well as the SQL query (Data source) itself.
We recommend using aliases for the fields names in the SELECT query because these are the aliases that will be displayed by the control Pivot, and it is best to choose them carefully to reflect the data they represent.
It is also preferable that the alias contain only one word, but if it contains more than one word, surround them with apostrophes.
The Data sources provided as standard by the Pivot Reports module cover the majority of Dolibarr business entities, so you can use them to create your own query.
The Pivot Reports module checks the syntax of the SQL query, if it is not valid a message is displayed with the error found.
The word SELECT is not mandatory, if it is not present, it will be added by the module before submitting the request to the database server.
When the Data source is successfully created, a default report is created as well.
This report is called "Default":
You can then set it in the main interface of the module.
Example of a default report created by a new Data source:
In the list of Data sources, a click on the name of the data source brings up the data source card in consultation mode.
You can then edit it by clicking on the "MODIFY" button or delete it by clicking on the "DELETE" button.
The module has specific processing functionality for time field values representing days, months, quarters, or semesters.
This treatment consists of:
- order them in ascending order (example for the months: Jan, Feb, ...)
- add the missing values (for example: if you did not make sales during the month of August, this month will be missing from the data source, and it will also be missing in the X axis labels of the charts.
To avoid this behavior, the module adds the missing months to have a more consistent charts)
- the months can begin with the first month of the fiscal year or the civil year (according to the setting of the module)
All of these features are only possible if you follow the following naming conventions for time fields:
Example: concerning the "Month" field:
t.date_command AS date_command,
(CASE MONTH (t.date_command)
WHEN 1 THEN 'Jan'
WHEN 2 THEN 'Feb'
WHEN 3 THEN 'Mar'
WHEN 4 THEN 'Apr'
WHEN 5 THEN 'May'
WHEN 6 THEN 'Jun'
WHEN 7 THEN 'Jul'
WHEN 8 THEN 'Aug'
WHEN 9 THEN 'Sep'
WHEN 10 THEN 'Oct'
WHEN 11 THEN 'Nov'
WHEN 12 THEN 'Dec'
ELSE '' END) AS Month,
Data sources are displayed as left menu in the main module screen.
To reorder these menu entries, you will need to use the Dolibarr menu manager.
- go to Home > Setup > Menus
- choose the "Menu editor" tab
- select "All" in the combo "Menu handler" and click on Refresh
The entries in the left menu of the Pivot Reports module are then visible.
You can reorder them using the small arrows at the end of each entry.
NB: Do not use this screen to edit / delete an entry from the left menu.
For modification / deletion, use the module Data sources manager instead in the admin part of the Pivot Reports module.