AggregationProperty with dynamically generated table

Hi, I have a table created dynamically by code with a datasource of type: valueGroupDatasource also created by code. My question is if this is supported to create aggregation type “SUM”, I have the following code but I am throwing an error, what would be the correct way to do it ?:


Table laTabla = componentsFactory.createComponent (GroupTable.class);
LaTabla.setDatasource (ds);
LaTabla.setWidth ("100%");
LaTabla.setHeight ("100%");
laTabla.setAggregatable(true);
laTabla.addAggregationProperty("compras", AggregationInfo.Type.SUM);

Where compras is a column of the table created dynamically by code.
Thanks and regards.

Hi,

See this answer: https://www.cuba-platform.com/discuss/t/create-a-table-dynamically-with-a-datasource-valuegroupdatasourceimpl-and-keyvalueentity#comment-7857