Compare two list items for checking inventory status

REALTIME DATA-
list 1 named snacks - (lays, noodles, pazzta) ----- stock list for snacks (1,5,6)
list 2 named staples - (spices, flour, rice) ----- stock list for staples (2,4,8)
list 3 named beverages - (pepsi, cola, mixed fruit juice) ----- stock list for beverages (1,4,3)
list 4 named all - (lays, noodles, pazzta, spices, flour, rice, pepsi, cola, mixed fruit juice)------ stock list for all (1, 5, 6, 2, 4, 8, 1, 4, 3)

items in cart and their stock status in a list view

  1. noodles (5)
  2. rice (8)
  3. pepsi (1)

how to compare cart items stock with realtime data as soon as cart initialize
supposse when no difference nothing happens
and if database stock has value 0 and carts stock value is 1 then carts stock value of item should be 0 and should be removed from cart

simplified
how to compare list of items in cart with list of items in database??? to see if item is out of stock or stock is decreased or increased and update the value to items in cart

Not going to any complex methods, you can solve it by refreshing your values (from db) in a loop! I recommend not using a clock, but refreshing values on screen changes!

Not necessary to remove them! You can print out of stock for that item on cart and let user remove it manually if he wants to.

1 Like

thanks @asimjib93
no one here seems to be helping me in any of my post, new community users aren’t valued that much is that so ?

Community Members may have different level of knowledge in different aspects of app development.
Some may be good in UI design, some may have a good knowledge of database and some may be well versed with different components available here.
You just need to have patience until any user having appropriate knowledge regarding your query replies to you.
If you do not get reply quickly or in expected time then it doesn’t means that no one is ready to help you. Everyone here are willing to help each other equally. It’s just that a correct user comes online(ofcourse in his/her free time) and solves your query. And this may consume some time, sometimes more or sometimes less

2 Likes

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