Tracker Android Capture program rules - Visit incrementation

Hi @gregory, thank you for reaching out and creating a test program to recreate this, it helped a lot for troubleshooting the issue.
I am not sure why it didn’t fail in other versions but it does make sense that it would go into a loop, as the second program rule condition will check whether previous visit number has value, and add one to the current visit, and then check whether it has value and add one and so on.
By adding a few more checks to the condition to set the value it does work as expected.

new program rule condition:

d2:hasValue(#{Session Number Previous}) && !d2:hasValue(#{Sesion Number}) && ((#{Sesion Number} - #{Session Number Previous}) < 2)

I have however detected an unexpected behaviour where after modifying the event date where the Visit number field becomes editable which is not correct. And would break the assignment addition for visit number data element if the user modifies it and it does not fulfill the new program rule condition.

image
image

I have created an issue to resolve this in Jira you can track it here

Don’t hesitate to get in touch if you encounter any other issues.

Regards

Xavier Molloy