Sum list from local DB

Hello,

I’m looking for an option to get a number sum from a list located in the local DB Data sources.
I managed to go around and create the desired sum number, but the problem is when I’m deleting a row from the data viewer the number goes crazy of course because the deleted item wasn’t deleted from the list properly.

In short, is there a smart way to create a sum number from a column in the local data sources DB and when an item is deleted, update the sum number correctly?

Thanks in advance!

Hey @oreeldadln

There are a few examples of how to do this in the Community that you can find by searching for “Sum List

Here’s one that jumped out at me:

let me know whether or not that works for you.

Working Perfectly. Thank you!

I want to sum values in a database.
Attach find my blocks. But it gives me a NaN answer. What am I doing wrong?

It looks like you’re trying to add the value of a single database cell to the total score three times.

If that’s not working, try (inside the repeat block) setting the value of a variable to the Get Value block first and then adding that variable to the total score. It could be that the repeat loop is happening too fast and the Get Value block doesn’t have time to complete. You might need to add a Wait 0 seconds block at the end of the repeat block or even Wait 0.03 seconds. See if either of those help.

Thanks for the reply, but it is still not working.
Any other easy ways to calculate the score in a database?

It could be that the Get Value block is still buggy. This has been a long-standing issue and I’m not sure if it’s still causing problems. What happens if you set a label’s text to the Scores value in the loop and watch it? Do the values you’d expect to get from the Data Source appear?

You can also share a link to the project and I can test it myself which might help me find the cause faster.