It is possible to do Sum many labels text

I want to do Sum many labels text complete by tinydb tags call.

Is it possible or what is the good process?


Use a subtotal variable.

Set the subtotal to 0.
Go through all the values, and add each value to the subtotal.

I have tested this in replace the list with my labels but I have an error The second argument to foreach is not a list. The second argument is: 0

Please download and post each of those event block(s)/procedures here ...
(sample video)

TotalR is not a list is a number. Peplace get global TotalR with get global numberlistR

In effect, I don't seen my error.

Thanks, I modify and test this later

I apparently missed your blocks earlier.

The problem with doing a global init of a variable built from Label.Text values, is that the variable does not change its value later when the Labels change their .Text values.

You need to build your global init from the Label components (Label3, Label5) and use the Any Label.Text block later to retrieve current .Text values.

P.S. Sorry @dora_paz, you missed it too.

1 Like

Other error The operation + cannot accept the arguments: , [0], [""] with the fix of @dora_paz.

@ABG is it possible to make a list with call tinydb tags directly?

Probably like this?

As mentioned, you should re-init your list before summing each time
You have to test for empty values in your list otherwise the loop cannot add them

If your list is stored in a tinydb, then you can call this list with get value, specifying the correct tag.

How I can place this block in my actual blocks?

set it to your Label52.Text block

1 Like

I was not sure but I will prefer ask before.

But thanks, it's Really good.

Yes, but you would need to add each item of the list from a TinyDB.GetValue block one by one at run time, not in an init global variable block.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.