Issue: Z-Score Calculation in Program Rule

I am encountering an issue when using Z-score calculation in a program rule within any program. Whenever I apply the calculation, I get an error in the console.

Steps I have taken to debug:

  1. Checked if the value exists using d2:hasValue() for weight,height,gender
  2. Ensured the value is greater than 0 before performing calculations

Tested on a demo instance, but the error persists

how to mitigate this,

1 Like

Hi @rcpoudel

Were you able to reproduce this issue on play or a local demo instance? If you were able to reproduce this issue on any of the play.dhis2.org instances would you share the steps to reproduce so I can test on my side?

Thank you!

Dear @Gassim,

Here is the steps to Reproduce:

  1. Go to DHIS2 Play 2.41.3.
  2. Open the Maintenance app.
  3. Navigate to the Child Program and add Height and Weight to the Baby Postnatal program stage.
  4. Ensure that Gender is present in the Tracked Entity Instance (TEI).
  5. Create the following Program Rule:
d2:hasValue(#{Height}) && 
d2:hasValue(#{Weight}) && 
#{Height} > 0 && #{Weight} > 0 && 
d2:zScoreWFH(#{Height}, #{Weight},A{Gender})>-2 - Evaluation ended up as: d2:hasValue('Height') && 
d2:hasValue('Weight') && 
0 > 0 && 0 > 0 && 
d2:zScoreWFH(0, 0,"Male")>-2
I tried all the possible alternative on expression.


  1. Open the program in the Capture app.
  2. Try adding and editing data.
  3. Check the browser console for any error messages.