 Hi All-
I’ve been using calculated PRVs and program rules to calculate a score in one of my tracker programs. The general process I used was calculating an intermediate PRV as either 0 or 1 based on each condition that contributes to the score, then adding all the PRVs together to come up with a final score and assigning that final score to a DE. The expression that is assigned to the DE is something like this, where #{Xn} is a calculated PRV with value of 0 or 1.

#{X1} + #{X2} +#{X3}+ #{X4} + #{X5} + #{X6} + #{X7}

This was working fine, and returning a value between 0 and 7. However, we recently upgraded to 2.35.7, and I realized that now the above expression is concatenating the PRVs. Its returning something like this:

0101100

I reviewed the release notes and can’t find anything related to this. Has anyone experienced something similar?

Hi @kstankevitz!
This seems like a bug/unintended behavior that we need to investigate. Its great if you can report it on https://jira.dhis2.org/

Regards,
Markus

1 Like

It seems like if x1 = 1 and x2 = 0, x3 = 0 and x4 = 1, the assigned score will not summarize: x1+x2+x3+x4 = 1001

But if I set x2 = 3 and x3 = 4, the assigned score will summarize the way we want: x1+x2+x3+x4 = 9.

I’ll create the jira right away.

1 Like

Thanks so sharing this info… so it seems like when the variable value is zero, it’s treated as a string, so what if we specify that it’s a number using ‘\d’?

so @kstankevitz expression will look like this:
`'\\d#{x1}' + '\\d#{x2}' + '\\d#{x3}' + '\\d#{x4} + '\\d#{x5} + '\\d#{x6} + '\\d#{x7}'`

Thanks!

Jira: DHIS-12029

2 Likes

Thanks for this suggestion. I attempted this, but it doesn’t seem to be working. It returns false, value_not_positive_integer.

Based on troubleshooting others did to point out the 0s are the issue, i ultimately assigned the intermediate values and 1/2 instead of 0/1. Then I sum 7 PRVs and subtract 7 to get the true score. This works for now.

Thanks all!
Kayla

2 Likes

Hey! Sorry my suggestion didn’t work, I was just guessing!  That’s really great that you were able to find a workaround! Feel free to add it to the Jira issue! I look forward to your participation in the CoP, maybe you’ll find other workarounds for other users  Thank you!