I would like to use two variables under the Trigger column since I have two options/scenarios that could happen depending on a condition.
I have two types of household visit (First visit and Revisit).
Any type of visit you chose requires that you key-in the number of households or structures in that compound.
If the respondent erroneously said there are 5 households, you would be required to give information for all the households even if there were only 3 households.
I need to use ${first_visithouseholds} ' , ' ${revisit_households} questions to serve as the trigger under the Trigger column so that I can go back and change number of households from 5 to 3 households to recalculate so that the repeat function does not ask for 5 households but instead ask for 3 households.
2. What app or server are you using and on what device and operating system? Include version numbers.
I am using ODK collect v1.25.2 on a Samsung Tab4 using Android version 4.4.2
3. What you have you tried to fix the problem?
I introduced a third row ${total_households} that calculates (sums the two options, if(${firstvisit_households}=null,0,${firstvisit_households})+if(${revisit_households}=null,0,${revisit_households})
Then used the ${total_households} variable under the Trigger column, but because its not a visible question, I am getting an error when I use the Online XLSForm converter (Error: The question ${total_households} is not user-visible so it can't be used as a calculation trigger for question ${position1}.)
4. What steps can we take to reproduce the problem?
Is it possible to use two visible questions under the Trigger Column to help avoid this error?
(Error: The question ${total_households} is not user-visible so it can't be used as a calculation trigger for question ${position1}.)
5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.trigger_test_Saduma.xlsx (10.7 KB)
Is a new form submission filled out for each visit? That is, does the data collector fill out the form once for the first visit and fill the form a second time for a revisit?
In the data, how do you plan on linking the survey submissions to a single compound? Maybe you will need some sort of question to select the name of the compound. I don' think you need the calculation for the buildings to be mapped, just have:
a question to record which compound
a question to record which type of visit
a question to record building being mapped during that visit
if you want, you can include an acknowledgetype question to have the surveyor confirm the number they entered before continuing
Then in your data table you can use filters and sorting to get any of your statistics. If you need all buildings mapped on a first visit you can filter by the "type of visit" column and count the building mapped in the remaining rows. If you want the total buildings for a compound, you can filter on the compound question and count the buildings mapped in the remaining rows. Etc...
On the revisit how does the surveyor know which structures were mapped before on the first visit? If you fill out a separate form for each building (instead of using a repeat group) and collect a geo-point you could then see which buildings you've completed on a map on the phone. See the page for https://docs.getodk.org/collect-form-map/.
This particular question wasn't addressed, and I was attempting to trigger using one of two user input fields eg ${field1} or ${field2}, but adding the second field caused the calculation not to occur at all.
Is this supposed to work / not supported? If not, is there another way to trigger off >1 user input fields?
Under the hood, using the trigger column generates a setvalue action targeting the field represented by that row. The calculation in that row is triggered by an xforms-value-changed event when the node referenced in the trigger column changes.
In the raw XML, you can have setvalue actions targeting the same field based on multiple xforms-value-changed events.
Presently the manner in which xforms-value-changed event-triggered setvalue actions are exposed in XLSForm means that you can only specify a single trigger control in the XLSForm. However, if you wish you can define multiple setvalue actions (against different controls), all of which happen to have the same calculation and target element, but this needs to be done in the raw XML XForm definition.
If you look at the example in the XForms spec it should hopefully be apparent what you need to put under each of the source 'triggers'. It's just important to realize that, despite in XLSForm these triggers are defined against the target control/row, in reality the actual resulting setvalue actions are defined under each of the associated trigger control(s).