How to check if a product exists in the cart before adding it

0
I'm working on a Mendix project where users can add products to their shopping cart. Before adding a product to the cart, I want to check if it already exists in the list of cart items. I plan to implement this using a loop in a microflow. What would be the most efficient and effective way to achieve this? Any suggestions or best practices would be greatly appreciated.
asked
1 answers
0

Assuming the following simplified domain model:

image.png

 

a loop based solution would look like this.

 

image.png

 

Please note that this is not the best solution.

You can accomplish the same thing using the find operation from the list operation activity, and it will be much faster.

image.png

answered