I have a dynamic extraction system implemented that uses (today) the datatable component as output. That is working well, but we want to improve user experience using pivot table as the output so he can organize, filter and do calculations with the output data.
Important information to begin: since the data retrieved is dynamic (user will choose which information should be available), we don’t know how is the data. Could be {name: '1001', amount: 34.5} as could be {year: 2017, identifier: '22', production: 23.2}.
Questions:
The very first question is if it’s possible to translate the data keys with pivot. For example, if the data is { 'site.name': 'SomeName'} instead of showing ‘site.name’ in the fields list and column header, show ‘Site - Name’.
Sometimes, we retrieve empty data for some records. For example, If I have two entries in my data: {name: 'SomeName', year: 2015, production: 12} and {name: 'DidNotProduced', year: '', production: ''}, and want to see the production per year of all sites, I end up with a undefined column with no data. It is possible to not have that?
Obs: I wanted to do a snippet to show the problem, but I don’t have access to pivot table in the webix snippet.
Thanks for this snippet. It allowed me write one of my own with the behavior I described in the post: Code Snippet
As you can see, If I have a record with missing data (something that is possible in my case, since the data is dynamically constructed) I end up with a undefined column.
We will update the logic of the pivot, so it will exclude records with undefined key for columns and rows from calculations. As results there will be no “undefined” keys in rows and columns scales.
Not quite sure about cases when key contains null or empty string value, it can be usefull in some cases and useless in other ones.
If you have a license, the updated Pivot control will be available in next few days through npm/client-area. If you are using a trial - drop us an email and we will send you the updated version when it will be available ( or just send me your email through PM )