Sum values in a repeater, can anyone help me?

i try to solve the problem for more than a week but i reach my limits. Apparently it is only a small change but I do not notice it. I have tried to sum up the products in the shopping cart but it does not do what it should do. Maybe it is the formal or the variable. I will upload the file and hope you can help me. I would be very grateful if you would take the time to help me. Thank you in advance!SumRepeater.rp (4.2 MB)

Hi reggy!

I hopefully have a solution in the attached file. Essentially, I added a global variable labelled “Total” which gets appended with the item price whenever the “In den Warenkorb” button is clicked on an item. This was done with a “Set Variable Value” action, added to the “Click or Tap” event, with the value set to “[[Total + Item.Preis]]”.

I then had to modify the values in the “Preis” column of the repeaters dataset, to remove the Euro symbol and replace the commas with decimals (it needs a fair bit of logic to strip these elements out when summing the values, so it’s better to keep integer values by themselves, in a decimal format).

Now that we are summing the item values in the “Total” variable, we need to reflect this in the “Cart”. To do this, I added a “Shown” event to the carts “Dynamic Panel”, with a “Set Text” action targeting the “PreisSumme” widget, that sets the value to “[[Total.toFixed(2)]]]”.

As all values in the repeaters dataset now lack the Euro symbol, I then added a separate widget to reflect this currency on each item and next to the “PreisSumme” widget. As a note, it is often best to place the currency symbol to the left of the value, as varying number sizes can mean that the symbol gets overlapped, or appears too close, if it is on the right,

Hopefully that puts you in the right direction but please let me know if you have any questions!SumRepeater_solution.rp (4.2 MB)

1 Like

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