-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty integer values in Enketo forms evaluate to 0 #7222
Comments
This issue is fixed in version Basically, in older versions of this code when performing a mathematical operation in a However, in the newer versions of this code the values from the nodes (including unanswered questions) are first processed through a new |
Just wanted to note that the ODK docs do describe how to properly deal with empty values in Math functions. The TLDR is that anywhere that we are performing a calculation that involves the value from an |
This also applies to One thing to note is that does not affect the behavior of statements like |
@medic/quality-assurance this is another issue that should be resolved by the Enketo uplift: #7256 |
Config: Default File Reproducible on
|
Describe the bug
The ODK Documentation specifies:
When a form in cht-core is saved with an unanswered number question, the value for that question is properly recorded as
''
. However, if a calculation is performed in the form that references the unanswered number question, the value for the question will be treated as0
instead ofNaN
. So, if you have some other form element that is based on a calculation involving the number question, it will behave unexpectedly.To Reproduce
Steps to reproduce the behavior:
This is shown if number < 10
is displayed even though there is no value for My Number.Expected behavior
The calculation behavior should match what is documented for ODK (unanswered number questions are nil). Notably, if I upload that same test_form to https://getodk.org/xlsform/ it behaves as expected and the note is not shown unless a value < 10 is actually entered for My Number.
Additional context
Originally posted to the CHT forum.
It seems possible that this is caused by cht-core using an older version of
enketo-core
and this issue may be fixed by #6345. However, I was not able to find any issues/documentation in the Enketo project around this issue to indicate it was something that they fixed.The text was updated successfully, but these errors were encountered: