adding limits

145 views
Skip to first unread message

Thulani Gebuza

unread,
Feb 15, 2016, 6:30:07 AM2/15/16
to Kobo Users
Good day

How does one get to set limits on an open ended numeric question on KoboCollect?

These would be, for example, a question that accepts a minimum of 5 and a maximum of 30.

Regards
Thulani

Enrique Ramírez

unread,
Feb 15, 2016, 8:59:26 AM2/15/16
to Kobo Users
Go to settings (in the numeric questions) and in Validation Criteria field click on Manually enter your validation logic in XLSForm code and paste this code

string-length(.) >= 5 and string-length(.) <= 30

Enrique Ramírez

unread,
Feb 15, 2016, 2:21:28 PM2/15/16
to Kobo Users
I was checking the code again and realize that when the integer is larger than 16 digits, kobo automatically converts it in an exponential number.

So, my recommendation is to create a text question and instead the code I gave you up; use this one
regex(., '[0-9]') and string-length(.) >= 5 and string-length(.) <= 30

what this code does is to restrict the field only to accept numbers and also restrict the length

Regards,

K.


El lunes, 15 de febrero de 2016, 8:30:07 (UTC-3), Thulani Gebuza escribió:

Patrick Vinck

unread,
Feb 15, 2016, 2:49:07 PM2/15/16
to kobo-...@googlegroups.com
Thulani, are you seeking to restrict the number of digit (length) if the answer, or just that the number provided has to be between 5 and 30?

--
You received this message because you are subscribed to the Google Groups "Kobo Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kobo-users+...@googlegroups.com.
To post to this group, send email to kobo-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kobo-users.
For more options, visit https://groups.google.com/d/optout.

Thulani Gebuza

unread,
Feb 15, 2016, 4:47:39 PM2/15/16
to kobo-...@googlegroups.com
Hi Patrick

the number provided has to be between 5 and 30

> You received this message because you are subscribed to a topic in the
> Google Groups "Kobo Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/kobo-users/JZ00zjaEmGU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

Patrick Vinck

unread,
Feb 15, 2016, 6:29:14 PM2/15/16
to kobo-...@googlegroups.com
Hi Thulani,

  1. You need to first add a question and select the 'number' as question type.
  2. Once the question is added, you need to edit the question settings - click on the cogwheel on the top right corner of the question box.
  3. The settings option will appear with a menu bar on the left with three options - Question Options / Skip logic / Validation criteria
  4. Select Validation Criteria
  5. Select 'add a condition'
  6. Enter the condition using the signs and values you want - you will have the option to add multiple conditions, and make sure to select that the question must meet all the criteria specified. Your screen should look like the attached.


Validation.png
Reply all
Reply to author
Forward
0 new messages