Ledgers
Definitions:
- A ledger is another type of case property
- A ledger is a table of numbers saved to your case
- Rows of the table are products
- Columns of the table are the any numbers you want to track (stock, balance, price, order amounts ...)
- A ledger is readable individually, you can access the stock legder
Do you want to use a ledger?
- You are a community health worker who manages ORS, zinc, and vitamins
- You are building an app to track shipments of products over time
- You are building an app to track orders/requisitions of products over time
- You want to track the number of Rapid Diagnostic Tests (RDTs) at a facility over time
- You want to make a sandwich shop app that tracks how much money 50 different clients owe you
Transactions
Transaction allow you to save and update numbers in a ledger.
•There are 4 types of transactions
•Set a balance – set ‘Amount’ to a specific value
•Receive - increment ‘Amount’ by a specific value
•Dispense – decrement ‘Amount’ by a specific value
•Advanced: Transfer - decrement ‘Amount’ by a specific value on this case & increment ‘Amount’ by a specific value on another case
•Under-the-hood bonus
•Transactions are atomic – so if your phone shuts down mid-transfer, things don’t get lost.
Transactions are also resolved meaningfully. In CommCare, if 2 phones increments the same number, whichever phone writes last wins. In CommCare Supply, the increments are summed.