Creating a tiered discount using mendix.

Hey!   Iam having trouble creating a tiered discount, iam currently using a datagrid under my product like so (see screenshot) Which provides a way to attribute a discount and number of items needed of discount. However if I press the new button above it just ends up overwriting the existing variable. How do I fix this? I want to be able to have multiple discounts. Many thanks!
1 answers

Hey Erwin!


Thanks for your reaction. The new button is a standard create button attached to a datagrid with this config (see screenshot)




Which then links you to a page where you can enter the number of products needed for discount and the amount of discount. The idea is here that this would be infinitely changeable and create a new unique value each time.


As for the domain model, the actual discount number (called Staffelkorting) is in my "product" entity. Together with the needed number of products for the discount (called AantalVoorKorting), both of them integers. 


The page the new button links to is as follows (see screenshot)



As for the domain model, it is really chaotic but I'll share it here


Thanks for your reaction