Case sharing with separated and updated stock


(B.Gueye) #1

Hi all - i have a case to manage but i’m not sure of the the best way to do that.

  • i have three sites of vaccination A,B et C
  • All the vaccines are stored at site B and when there is a need at sites B et C, vials of vaccines are sent.
  • for now i have already created two modules : the first contains a form “Move vials” and in the case management of this form, i set up a child case to create a new one in the second module to receive vials. the form is called “Receive vials” (Means that Site A send vials et Site B receive vials).
  • So i want to separate the stock of these sites. Means that when site A have 100 vials of vaccines et decide to send 20 vials of vaccines, stock of site A will remain 80 and the new stock of site B will be 20.
  • And when site B decide to return a number of vials of vaccine to site A, like 5, stock of site B will remain 15 and stock of site A will be updated to 85.
    Thanks for guide

(Clayton Sims) #2

Hi,

If you set up your cases such that B is a Child Case of Parent ‘A’, when Case ‘B’ is accessed in a form you can reference the parent stock values.

IE: If the form collects “20” as the count of stock to transfer from A to B, you could create a hidden property like

parent_new_stock = #parent/current_stock - #form/stock_transferred

and then update the parent’s stock value to meet the new value.

-Clayton