Hi,
I am creating a very simple coupon app for restaurants.
Brief Context:
Each user can select multiple coupons. Each coupon has a certain price.
A user can buy different kinds of coupons for different prices.
At the end of the shopping cart, I want to be able to add all the subtotals (15 EUR and 15 EUR in the screenshot below), to calculate the total of the shopping cart. I have tried more than a 100 times but I am not able to figure it out.
I tried using Custom States, but I wasn’t able to calculate the total from the custom states. The custom state I used was for the repeating group that has the shopping cart. The data type of the custom state = number. And finally, I chose the custom state to be a list.
Some problems I encountered in Custom State (Repeating Group, Number Data, List type):
- If the user chose same number of different coupons- like in the example shown in screenshot, the user chose 5 coupons of 2 different type. This produces a subtotal of 5*3=15 and since he bought two different kinds of coupons, the total would be 15+15=30. The custom state includes 15 only once in the list.That is why I am not able to sum the numbers in RG in repeating group
- When the user changes the quantities of coupons using the dropdown (in turquoise in screenshot), the custom state list still retains the previous figure in the list in the same coupon cell. Hence, it keeps adding all the figures ever selected by the user (ignoring numerical duplicates).
I am having a hard time figuring out a seemingly simple problem.
Please help me add the numbers in RG!
Hugs from France! ![]()
