after long time I have to do sum values from a repeat but I don’t remember how to set up the variables.
The Server Connect is contains a query “Sellers” that list all the sellers. I set up a repeat where for each seller list the transactions and a variable that “count” the transaction.
I would make full sum of all transaction…
(I know that to get the total number of transactions, it would be enough to do a simple query. but at this point I would like to do it with variables to understand how it works to pass values from inside the repeat to outside the repeat.)
Here the server connect:
the value count_transaction give the right value per each repeat… but how I can take this value out of repeat?
Edit: I haven’t tested this on Wappler, this is what I would do on a regular programming language. If you experience any issues feel free to let me know!
Use the Global Name, when using Name it will set a variable in the current scope, so the variable is only within the repeat, setting the Global Name will set a global variable.
The total_items within the repeat will assign to the local scope of the repeater if you use Name, by using Global Name it will assign the value to the global scope and not the inner scope of the repeater, updating the outer variable.
The value expression can stay the same, just move the name to global name.