Hey guys:
I create an aggregation from a database and I want to show results in a table. This is de code:
export function button15_click(event) {
wixData.aggregate("HistoriaClinica")
.group("ciudad")
.count()
.run()
.then( (results) => {
let items = results.items;
$w("#table1").rows = items;
console.log(items)
$w("#table1").columns = [
{
"id": "col1",
"dataPath": "ciudad",
"label": "Ciudad",
"type": "string",
},
];
});
}
And this is the result in the table:

Question is: ¿How can I show the count results in the second column?
Thanks!!
Ok, so it worked with a table (nice to know)
.
Do not forget to connect your post with your privious one, so others can also learn from it
.
https://www.wix.com/velo/forum/community-discussion/display-aggregate-in-a-repeater
But I dont kwon how to show the count results!
This is what It shows the console:
_id:
"CIMITARRA SANTANDER"
count:
6
ciudad:
"CIMITARRA SANTANDER"
I need to show in one column the count
???
$w("#table1").columns = [
{
"id": "col1",
"dataPath": "ciudad",
"label": "Ciudad",
"type": "string",
},
{
"id": "col2",
"dataPath": "count",
"label": "Counts",
"type": "string", //number?
},
{
"id": "col3",
"dataPath": "_id",
"label": "Index",
"type": "string", //number?
},
];
@russian-dima YOU ROCK!!! IT FINALLY WORKS!!!
@danieltalero78
(now it’s really time to go to bed xD).
Good luck with your project and happy coding.