How to get specific field from array?

Basically the thing I am looking for.
I want all the data for a specific column in database so I can sum those all.

I want to sum all the data from “Number of species” from Record 2 to End. As I manually added this and that’s why you are seeing 199.

Below is my code which I used to get the data but I am not able to find it for specific field.

Kindly help me to get this issue resolved. Thanks

Hi,
if you want to sum all values in a column, you need to use Wix Data aggregations.

You could do something like:

wixData.aggregate('Taxonomic_groups')
 .sum('numberOfSpecies', 'total')
 .run()
 .then(result => console.log(result.items[0].total))

If you want to filter only some of the species, you can also add filters. You can find full documentation here:

I hope this helps.

Thanks for quick response!
I will implement it and will let you know in case issue not resolved.

It’s worked fine. Thanks a lot.

What about if I need to exclude first record of “numberOfSpecies” i.e. ‘199’ as I did it manually in database?

I want to show all sums of records of “numberOfSpecies” in first record “All”.

Can you please help me in this too?