Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Coming SoonIN THE MAKING...

Before starting to build your Supply application there are a few concept you must familiarize yourself with:

  1. Organisations (ex Locations)
  2. Legers
  3. Transactions
  4. Repeat groups

 

 

  1. Setting up iteration over the product list

    In order to iterate over a list of products, you need to set up a repeat group over the product list

    This is configured in the “products” repeat.

     

    • Click on the repeat → Advanced → Model Iteration ID Query

    • Click “Edit”

    • Set the following:

    • Click “Save”

    • This is the exact same for all product repeats.

    Your configuration should look like this:


    Image Added

    Extra: If you want to run the product only over a define list of products, you can use the Query Expression to filter the list.
    For example the following expression will run the iteration over product of a defined program: 
    instance('products')/products/product[./program_id=xxx]/@id


  2. Setting up transfer questions

 

  • Question ID: whatever you want

  • Source/Destination case: this is the case of the ledger or entity id.

    • For example if you want to apply the transaction to a ledger of the current case use: instance('commcaresession')/session/data/case_id

    • But any case id can be used here. 
  • Balance ID: This is the name of the ledger. The default should be “stock” but you can create any id you want.

  • Product: current()/../../../../@id

    • This exact text should be used for a transfer inside a group.

    • If the transfer is directly in the repeat remove one set of double dots and use: current()/../../../@id

    • Quantity: references a question in the repeat where you ask about, or calculate quantity. Normal calculates work fine here.

    • Here’s roughly how it should look:

Image Added