-
Notifications
You must be signed in to change notification settings - Fork 136
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
Add "trigger" column to use value changes as triggers for calculations #438
Comments
when
column to use value-changes as triggers for calculations
This looks great to me, @MartijnR, thanks for taking the time to carefully write out all these test cases, that really helps confirm that the proposal covers the necessary ground. One tiny thing, the value for the last case should be |
Hi @MartijnR Created PR #447 based on @lognaturel implementation. Changed when column to trigger column. |
This is now merged. We do need documentation before it gets released. |
Discussion: https://forum.opendatakit.org/t/xlsform-proposal-to-calculate-a-value-when-another-value-changes/24978/3
It would likely be very helpful to first implement a change in regular calculations: #70
It would perhaps be helpful, but optional, to first implement a change in label output: #439
Below is an attempt at creating cut-and-paste tests (i.e. with the new way of testing using markdown) that have to pass to implement this feature successfully:
Rules:
a. For all questions: if there is no calculation, either a label or a hint is required unless it has a value for 'trigger'.
b. If a question has either a label or a hint, a body element is included in the XForms output. (This is no change, but perhaps helpful to explain).
c. If a question with
trigger
has an empty calculation it will reset the value =>value=""
.Test 1:
Note: test for absence of
<input ref="/data/b">
in body becauseb
has no label and no hint.Note: the value in the calculation column gets a completely different XForms output if the trigger column has a value!
Test 2:
Test 3:
Note: test for absence of
<input ref="/data/b>
in body (no label or hint).Note:
c
has a hint and therefore<input ref="/data/c">
is included in the body.Note: the empty
<label/>
element (vs. omitting it entirely) is unrelated to this issue, but assumed to be implemented: #439. If it hasn't been implemented, it may still be missing entirely from the output.Test 4:
Test 5:
Note: test for absence of
<input ref="/data/e">
in body (no label or hint).Test 6:
Note: this is essentially like test 2 but with a group.
Note:
trigger
column on begin_group should be ignored by pyxform.The text was updated successfully, but these errors were encountered: