Is it possible to use (${question} > "answer") for skip logic?

I’m trying to create a questionnaire using XLSform in xcel and use it in kobotoolbox, but I’m stuck at the stage of creating skip logic.

  1. I made a [select_one] Question which has 48 selection.
    2.The 48 questions are related to time and are named T1 to T48. (like,T1=00;00,T2=00;30,…T48=24;00)
    3.In the next question, I’m thinking of making it so that it skips according to the time selected in question 2.

So, the problem is how to set up a skip logic such as “Skip the question when the time is T14 or more”.
As a test, I tried a command on XLSform like ‘${question}>“T14”’’ but it didn’t work. is T14 or more".

Is there anyway to do that in kobotoolbox?
Could you tell teach me that way?

I’m sorry for that I cannot attach my excel data.

"… T14 or more”.
would require ${question} >= “T14”. But Kobo evaluates this always to false!

Strings don’t work well here! You can try: “T2” > “T1”… And “T14” >= “T1”. Both evaluates to false! Even "T1 >= “T1”…

Do you use Collect or Enketo?
Did you check your form with the online validator?


thank you for your reply
I already try to ${question} >= “T14”, but it didn’t work.
I’m sorry I don’t know how to check the ig strings “T2” > “T1”…And “T14” > “T1” …
It’s very happy for me to tell me the way.

“…Collect or Enketo”
I think I use Enketo.

“…online validator”
I didn’t use this checker, thank you for your introducing.
then there is an error like…

Error: ODK Validate Errors:

XForm is invalid. See above for the errors.
: Encountered a problem with display condition for node [${M1LS7_Q1}] at line: ${M1_getup} =>“T7”, Bad node: org.javarosa.xpath.parser.ast.ASTNodeAbstractExpr@69a3d1d

The following files failed validation:

Result: Invalid

So, you first need fix this: … >= … is the syntax. (See ODK XForms Specification).

You may just write this in the same place (relevant clause). If strings work here, it should be true (relevant).

See Help Center article
Overview on Data Collection Tools — KoboToolbox documentation.

@Kal_Lam can provide the right to attach files here.


Demo.xlsx (16.4 KB)

Sorry for my late reply.
Now I attached my excel sheet.
Would you check it and tell me the wrong place ?

Thank you for your all information.
I’ll also check the syntax.

@Lema, maybe try coding it in this way and it should help you solve your issue:

In the survey tab of your XLSForm:

In the choices tab of your XLSForm:

Reference XLSForm:

Demo.xlsx (16.2 KB)

Please note that I have only edited for the first row (for your sample) to show it can be done.

1 Like

Finally I can do it in skip logic.

Thank you for your advice!

1 Like

In KoboToolbox, you can use skip logic to skip a question based on the response to a previous question. However, the syntax you mentioned (${question} > "answer") is not supported in XLSForm for skip logic comparisons. Instead, you can use the relevant column in your XLSForm to specify skip logic conditions.

To implement skip logic based on time selection in question 2, you can follow these steps:

  1. In your XLSForm, add a new column named relevant next to the question you want to skip based on the time selection.
  2. In the relevant column, use an expression that evaluates to either true or false to determine whether the question should be shown or skipped. For example, to skip the question when the time is T14 or more, you can use the following expression:

bashCopy code

selected(${question2}, 'T14') = false

This expression checks if the response in question2 is not equal to ‘T14’. If it’s not equal, the expression evaluates to true, and the question will be shown. If it is equal to ‘T14’, the expression evaluates to false, and the question will be skipped.

  1. Repeat these steps for each question that needs skip logic based on the time selection.

Make sure to adjust the column names (question2) and the time value (‘T14’) according to your specific XLSForm.

Once you’ve made these changes in your XLSForm, upload it to KoboToolbox, and the skip logic should work as expected based on the time selection in question 2.


Comparisons seems even more complicated and partly a bit surprising in Kobo/ODK, see the examples here:
CompareText01.xlsx (12.9 KB)

Ok, at least we would expect the same with choice_list, as choice names/values are stored as strings.

But Kobo/ODK :
With choice_list 1, 2, 3

And even different with choice_list 01, 02, 03 (Kobo seems to do a different conversion?)

Tested with the Online validator / Preview (Enketo).

I am not sure if we get the same behaviour with Collect??

Maybe @Kal_lam, @Xiphware may have a look and explain more, please.

Hints can be found here XML Path Language (XPath).
" First, comparisons that involve node-sets are defined in terms of comparisons that do not involve node-sets; this is defined uniformly for =, !=, <=, <, >= and >. Second, comparisons that do not involve node-sets are defined for = and !=. Third, comparisons that do not involve node-sets are defined for <=, <, >= and >."
When neither object to be compared is a node-set and the operator is = or !=, then the objects are compared by converting them to a common type as follows and then comparing them. If at least one object to be compared is a boolean, then each object to be compared is converted to a boolean as if by applying the boolean function.
…, if at least one object to be compared is a number, then each object to be compared is converted to a number as if by applying the number function. Otherwise, both objects to be compared are converted to strings as if by applying the string function. The = comparison will be true if and only if the objects are equal; the != comparison will be true if and only if the objects are not equal. Numbers are compared for equality according to IEEE 754 [IEEE 754].


see your quote.

?? To delete, please

1 Like

Hint: You could do this in a relevant more simply: ${question2} != “T14”. This is a boolean expression already, will exclude T14 cases only, and selected(…) is only needed for a select_multiple type.

Of course, this wouldn’t solve Lema’s skip requirement for > “T14”.
A solution could be
${question2} = “T1” or ${question2} = “T2” or … or ${question2} = “T14”}.
Hint: This relevant would also skip for ${question2} = “” (i.e. empty).

Did you test your expression, incl. with the online validator? Maybe it would need … = false().

1 Like

Done! Thank you for flagging this @wroos! @BrianJohnson, please help the community to keep the content clean.

@itzayanagarth14 thanks for share all this information with us.

1 Like