Can someone please explain how to use the orderBy column in queries? We are using in the ODK Survey 2.0 rev218 and cannot find any documentation or examples for how to use it properly.
For example, if we have created a household of 8 people using a household members subform, and then we create a select_one_dropdown variable calling on the members of the HH. How would we use the orderBy column to order the members by ID number (q301).
We have tried different specifications in the orderBy column that do not work:
Hmm, that’s a good question. I just tried it out on the Household Survey example and wasn’t able to get it working. I wonder if this is a bug. I’ll investigate this further.
I have to admit I don’t know the proper syntax, but I’ll add it to the documentation when we find it. Please let me know if you figure it out in the mean time.
We can keep experimenting and let you know if we succeed… been trying a number of things for a while, though. Another one we tried in the orderBy column was: _.orderBy(context, [‘q301’], [‘asc’])
If anyone has any sense of how it should work, let us know, as it might narrow down our testing
In your queries worksheet, you would create an order_by column. Here you would put the name of the column you want to order by followed by the direction. The default direction is ascending if nothing is specified. Please look at the Tea_type_list query in the queries worksheet of the attached Tea_houses_orderBy.xlsx (12.9 KB). In this example all of the rows of the Tea_types table are ordered by the Origin column in descending order. Let me know if you have any trouble.
Thanks @clarice_larson! This works great and keeps our households and such all ordered!
No problem. I’m glad to hear that this worked!