Problem with pivot table and custom datasource

Hello, I am trying to create a pivot table that is loaded by a custom datasource which calls a service to obtain the data. This service makes a query to the database and then creates instances of a non-persistent entity to contain the returned data, this non-persistent entity is the one that is returned in the custom datasource. The problem is that the service does return all the data but the custom datasource is only storing the last record and therefore only shows me a record in the pivot table. I attach images of the code and I appreciate any help that indicates me that I am wrong.
Thanks and regards.

StudioCustomDatasourceCustomDatasourceRefreshCustomDatasourceServiceCustomDatasourcePivotTableCustomDatasourcecustom-datasourcecontroller-load-customdatasourcecustom-datasource-studio

Hi,

Could you attach a sample project, so I will be able to investigate the problem?

Regards,
Gleb

Hello Gleb, I send an attached project. Maybe I’m not generating the appropriate table structure to show the data, as you will see the table where the data is stored is “Analysis” and has two fields referenced to other tables in a many to one: “Hierarchy” that placed it in the rows and “Concept” that I place in the columns, the problem is that I do not leave references to these columns of the form: concept.description and hierarchy.level1, hierarchy.level2, etc in Cuba studio, that’s why I had to build an entity not persistent to save the values in a way that you can then display them in the table pivot. I would appreciate if you could indicate the best way to store the data and show them in the table pivot.
Thanks and regards.PruebaPivotTable.zip (100.8 KB)

Hi,

In the ObtenerDatosServiceBean#getDatos you need to define ID for a created entity manually, for instance:

pivotTableSecciones.setId((int) uniqueNumbersAPI.getNextNumber("TablaPivot"));

Regards,
Gleb

Thanks Gleb, Its ok.