Specify Order of Choices in CommCare Multiple Choice Lookup Table

commcare

I'm interested in two use cases:

  1. Re-ordering choices by a field uploaded in a look-up table
  2. Re-ordering choices by a case property in a list of cases specified by a Query Expression [when the "Custom Single and Multiple Answer Questions" feature preview is turned on]

Best Answer

For lookup tables

The order of choices from a Multiple Choice Lookup Table are defined by the order that they are uploaded in. Therefore if you a column in your lookup table that looks like:

Color
----
Blue
Red
Yellow

The choices in the question will appear in that order.

For a query expression

XPath unfortunately does not let you specify the order in which your nodes are returned so the order is undefined, but most likely reflects the order that they exist in the database.