Dynamic repeat count XLSForm

ODK Central Version 1.0 (but also in 0.9)

I have a form with a dynamic repeat count (repeat until I click "last form"). It works under 1.0, but gives a warning ("behaviour has changed) I do not understand, and I have to override the warning every time. This is ok for me, but confusing for end-users.

What can I do to get it to work? I checked the example by @Grzesiek2010 in Repeat group and relevance, but it gives many errors and does not work.

repeat_test.xlsx (12.5 KB)

I'm guessing you're seeing this text:

Repeat behavior has changed. Previously, some clients like ODK Collect prompted users to add the first repeat. Now, the user will only be prompted to add repeats after the first one. Representing 0 repetitions will require changing the form design. Read more at http://xlsform.org#representing-zero-repeats.

I believe it will show for any form with repeats in it. You can safely ignore it and hit "Upload anyway" (as I assume you're doing). We'll hopefully be able to remove it soon enough but for the moment it is important to warn user's with older forms that the behaviour has changed.

Please, remove it as soon as possible.
When using an API, I have to use ugly code as below to let normal warnings pass and repeat with ignoreWarnings on 400.16

      ht_create = httr::POST(url_create, body = body,
                      httr::authenticate(un, pw),
                      httr::add_headers('X-XlsForm-FormId-Fallback' = xmlFormId)
                      ) %>%
        httr::content()
      # Try again on confusing warnings
      if (ht_create["code"] == "400.16") { # Redundant warning "Behavior has changed
        url_create = paste0(url_create, "?ignoreWarnings=true")
        ht_create = httr::POST(url_create, body = body,
                               httr::authenticate(un, pw),
                               httr::add_headers('X-XlsForm-FormId-Fallback' = xmlFormId)
        ) %>%
          httr::content()
      }

In that circumstance it might make sense to just always add ignoreWarnings=true if you know the form is going to produce them. If you're using the API to iterate on a form locally and then upload it might be helpful to use pyxform to verify changes instead of doing at the upload stage.

Thanks for pointing me to pyxform. I will have to weight the burden of using Python inside R against the try-retry method within R.

1 Like