Child pages
  • Counts using conditional logic in a calculated field
Skip to end of metadata
Go to start of metadata

Use case: User needed a tally of how many ER visits a patient has had. See Image A. Solution: Use conditional logic (i.e. an IF/THEN/ELSE statement) by using the function if (CONDITION, value if CONDITION is TRUE, value if CONDITION is FALSE).

Step-by-step guide

5 fields were added for users to enter emergency visit dates. See image A. 

  1. For fields edvisit2 to edvisit5, branching logic was added to show field only if preceding field is not null. For example, show edvisit2 if edvisit1<>"".
  2. To count how many visits have been recorded, a calculated field was added and an equation using if then statement was written to count how many fields had a visit date. See image B.
  3. Equation uses the function if([edvisit1]<>'', 1, 0) which reads if the field edvisit1 is not null, then the value is 1, if null, then the value is 0. 
  4. An if then statement is added for each field and then added together to provide a count of how many fields have data. See image C.



Image A


Image B


Image C