You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Overview

It may be useful to increment counters in a case values, the typical example being the number of Ante Natal Consultations (ANC) or Post Natal Consultations (PNC) a patient received. The case stores the number of consultations received and each form stores a number of the consultation received at that time. Such counters are implemented with a couple of hidden form values and a single case value.

Staying with the ANC example, the form has these hidden values:

  • Use a hidden value called /anc/previous_anc_number to get the number of ANC already received by the patient. If the patient is experiencing her third ANC, this value is 2.  Load this hidden value from the case property called anc_number
  • Use another hidden value (/anc/anc_number) to compute the current ANC number by adding 1 to /anc/previous_anc_number
  • Since anc/previous_anc_number can be blank in the case of a first ANC, we need a more complicated Calculate Condition of coalesce(/anc/previous_anc_number, 0) + 1
  • We then save  /anc/anc_number to the case, using the case property name /anc/anc_number

 

Explained Step by Step

To count or keep track of ANC visits in follow-up forms, do this…

  1. Create Hidden Value /anc/previous_anc_number 
  2. Create Hidden Value /anc/anc_number
  3. In /anc/anc_number, give condition coalesce(/anc/previous_anc_number,0)+1
  4. Go to the Case Management tab for this form
  5. Under Save data to the following case properties, save both /anc/previous_anc_number  and /anc/anc_number
  6. Under Load the following case properties into the form, load /anc/anc_number as the Case Property and /anc/previous_anc_number  as the Question

 Why do it like this?

  • The hidden value, /anc/previous_anc_number gives the number of ANC already received by the beneficiary. For example, if the beneficiary is experiencing her third ANC, this value would be 2.  This value is loaded from the case property anc_number, ie the number visit number saved during the beneficiary’s last consultation.
  • The hidden value (/anc/anc_number) is used to compute the current ANC number by adding 1 to/anc/previous_anc_number
  • Since anc/previous_anc_number can be blank in the case of a first ANC, we need a more complicated Calculate Condition of coalesce(/anc/previous_anc_number, 0) + 1.  Therefore, during the first visit, when previous_and_number does not have a value, it will be replaced by 0.
  • We then save  /anc/anc_number to the case, using the case property name /anc/anc_number

 

You can think of it like this…

  • No labels