Hello you all! I am developing a google data studio connector to ODK central database, and one thing that I would like to add to our connector is to allow user to select the number of rows to process when the dataset is too large. I find an endpoint to return the number of submissions of a given form, but I can't find the same functionality for a repeat table within the same form. Is there any workarounds? Thanks
Hi @hugh_sun! I believe that you can specify the query parameter
$count=true when fetching the OData for a particular repeat group. If you just want the count, specify
$top=1 as well. Note though that counting can be an expensive operation, because it will generate and iterate over all records for the repeat group.
By the way, since you're working on repeat groups, I thought I'd mention that in the upcoming version v1.2 of ODK Central, submission OData endpoints will allow you to specify
$expand=* to pull all repeat group data along with the primary data table. (See the forum discussion here.)
Thanks Matthew for the tip! Although this isn't exactly the solution I am looking for, maybe it is close enough. What we need is a faster way to get the number of rows than scanning through the whole repeat table but I guess there is just no such a count field within the table.
I think that's right: I don't believe there's another way you can retrieve the count. Since the request may take a while, you might want to allow the user to take actions even before the response has been received, including applying a limit on the number of records to fetch.
Note also that specifying the
$skip query parameters will not greatly improve the performance of exporting data. With repeat groups, ODK Central will iterate over all records even if you specify