odk

show next prompt based on answering the current prompt in ODK


I am new to ODK and I am trying to create an XForm in ODK and the following is the issue i am stuck in.

PROBLEM:
The user selects Gravel, Drainage or Unimproved from the first prompt. The next prompt is about the rating for the item selected in the previous prompt. Now I need to set rates 1 to 5 if Gravel is selected and 1 to 4 if any other is selected in the previous prompt.

What I have done:
I have set two prompts (Paser_Rates and Paser_Rates2), each has its own binding that the correct one is displayed based on the selected prompt.

<bind nodeset="/widgets/main_repeat/PaserRates" relevant="not(selected(../RoadType, 'gravel'))" type="select1"    required="true()" saveIncomplete="true()" />
<bind nodeset="/widgets/main_repeat/PaserRates2" relevant="selected(../RoadType, 'gravel')" type="select1"    required="true()" saveIncomplete="true()" />

This does not solve my problem because I am not supposed to have two prompts and I need to save the rating values in one column (Paser_Rates).

enter image description here

Please let me know what solution you have for this.


Solution

  • XForm terminology: The way to do this is to use itemsets with a secondary instance that contains your choice lists. Instead of relevants use an XPath predicate to determine which choices to show.

    XLSForm terminology This (and any other form) will be much easier if you use XLSForm to create your XForm. You need to create a cascading select and use a choice filter instead of a relevant to determine which choices to show.