# Reporting of aggregated data

**URL:** https://discuss.tryton.org/t/reporting-of-aggregated-data/437
**Category:** Feature
**Created:** [November 16, 2017, 10:47pm UTC](https://discuss.tryton.org/t/reporting-of-aggregated-data/437 "2017-11-16T22:47:50Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [November 16, 2017, 10:47pm UTC](https://discuss.tryton.org/t/reporting-of-aggregated-data/437/1 "2017-11-16T22:47:51Z")

</div>

## Rational

There is a need for a flexible and generic engine to display aggregated data.  
I think the easy solution is to build a generic pivot table tool but it does not really provide a good user experience. Such tool allow to make non-sense queries with false result and are [not easy to use](https://ux.stackexchange.com/questions/78392/simpler-query-builder-ux-for-querying-olap-dimensionally-modelled-data).  
Indeed I think we need to have a way to browse an predefined hierarchy (facts) with associated value (measures).  
And for temporal facts, I think it is not good to show an long set of columns with a lot of values (like pivot table would bring). Indeed I think we should use [Sparklines](https://en.wikipedia.org/wiki/Sparkline) like this [example](https://ux.stackexchange.com/questions/5730/can-you-point-to-any-good-examples-of-large-table-presentation-online/7453#7453) and allow to browse the temporal data as a list by clicking on the row.

## Proposal

Implement a generator of sparkline in SVG on server side like [GitHub - tgvashworth/sparksvg: SVG Sparklines all up in your browser](https://github.com/tgvashworth/sparksvg)

Such report will be implemented using an `UnionMixin` with a `rec_name`, all the values and a optional parent/children. This model represent a hierarchy of facts. The union models should be part of the same set `ModelSQL` using `table_query` which compute the values using the same context, this will be ensured by inheriting from the same class. They should just change the `group_by` clause of the query.

It may be useful to allow a client tab to have a selection of models to display. This will allow to switch from one report to another quickly.

## Implementation

---

<div class="post-metadata">

### Author: ![meigallodixital](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/meigallodixital/32/31_2.png) [@meigallodixital](https://discuss.tryton.org/u/meigallodixital)
#### Post date: [November 17, 2017, 9:20am UTC](https://discuss.tryton.org/t/reporting-of-aggregated-data/437/2 "2017-11-17T09:20:40Z")

</div>

I know of seeing it in other projects [pygal](http://www.pygal.org/en/stable/index.html), it has [sparklines](http://www.pygal.org/en/stable/documentation/sparks.html) and support py2 and py3. It seems more maintained than the other libray and comes packaged on linux distributions.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [November 17, 2017, 10:53am UTC](https://discuss.tryton.org/t/reporting-of-aggregated-data/437/3 "2017-11-17T10:53:55Z")

</div>

I seems a good choice.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [November 18, 2017, 5:33pm UTC](https://discuss.tryton.org/t/reporting-of-aggregated-data/437/4 "2017-11-18T17:33:20Z")

</div>

> [@ced](#):
>
> Indeed I think we should use Sparklines like this example and allow to browse the temporal data as a list by clicking on the row.

After some testing with pygal and SVG rendering, it does not work correctly in the client. I think it is because the generated SVG contains javascript. So I tested the Sparktext rendering. It works pretty well and it has the advantage to have smaller size as it is only a char.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [December 23, 2017, 10:46am UTC](https://discuss.tryton.org/t/reporting-of-aggregated-data/437/5 "2017-12-23T10:46:53Z")

</div>

> [@ced](#):
>
> It may be useful to allow a client tab to have a selection of models to display. This will allow to switch from one report to another quickly.

Indeed switching is not so good experience but having a single menu entry with multiple actions do pretty well the job.

---

<div class="post-metadata">

### Author: ![bala4901](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/b/fbc32d/32.png) [@bala4901](https://discuss.tryton.org/u/bala4901)
#### Post date: [October 1, 2018, 3:10am UTC](https://discuss.tryton.org/t/reporting-of-aggregated-data/437/6 "2018-10-01T03:10:35Z")

</div>

I am new here.

Just to share some thought, we may see the reporting from odoo.  
It is quite flexible to do aggregate dan data analysis.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [December 13, 2019, 7:22am UTC](https://discuss.tryton.org/t/reporting-of-aggregated-data/437/7 "2019-12-13T07:22:09Z")

</div>

A post was split to a new topic: [How to use multiple sequence](https://discuss.tryton.org/t/how-to-use-multiple-sequence/2084)
