Skip Logic at different levels

Dear all

I’m trying to use a skip at 2 different levels. This is how it looks:

condition1 = 1 OR condition1 = 2 AND condition2 = 1

Kobo allows me to use only AND or only OR when writing the code, but it doesn’t allow me to combine “AND” and “OR” in a specific skip, as showed above in the condition’s sentence. In my survey, condition1 and condition2 corresponds to two differents questions. And although I wrote this code as a hand code, it doesn’t work. I also tried to separate condition1 from condition2 as follows:

(condition1 = 1 OR condition1 = 2) AND condition2 = 1

but it still doesn’t work.

Have you any thought to fix this?
Thanks a lot!

The KoBoForm builder can create fairly complicated skip logic. I’d love to see your XML to get a better idea of what you are trying to do. You can probably do it in the Form Builder, or you can surely do it by writing a bit of custom XML skip logic.

Can you send the actual questions you are trying to add and their attached skip logic? I will be happy to take a look at it.

Alternatively, here are some more details about advanced skip logic from the user guide:

You can combine more than one Relevant value by putting “and” between them.

relevant="/data/q5= ‘1’ and /data/q6 = ‘88’"

You can also use negatives, that is, Question is Relevant IF another question’s value does NOT equal something.

relevant="/data/q5 != ‘0’"

When working with multiple-select questions , where users can select more than one answer, you can’t use node=‘value’ because there may be more than one value in there. So, you can use selected(node, ‘value’)

relevant=“selected(/data/q11, ‘88’)”

Yes, it can be combined with other Relevants for other nodes

relevant="/data/q9 = ‘1’ and selected(/data/q11, ‘88’)"

You can even say THIS question is Relevant only IF the multiple choice question does NOT have a certain value selected.

relevant=“not(selected(/data/q11, ‘0’))”

~Neil Hendrick
KoBo Developer

···

On Mon, Jan 28, 2013 at 9:47 AM, Mario Molina mariom...@gmail.com wrote:

Dear all

I’m trying to use a skip at 2 different levels. This is how it looks:

condition1 = 1 OR condition1 = 2 AND condition2 = 1

Kobo allows me to use only AND or only OR when writing the code, but it doesn’t allow me to combine “AND” and “OR” in a specific skip, as showed above in the condition’s sentence. In my survey, condition1 and condition2 corresponds to two differents questions. And although I wrote this code as a hand code, it doesn’t work. I also tried to separate condition1 from condition2 as follows:

(condition1 = 1 OR condition1 = 2) AND condition2 = 1

but it still doesn’t work.

Have you any thought to fix this?
Thanks a lot!

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 http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

HI Mario,

In addition to Neil’s comment, I will test the combination of multiple conditions that combine AND and OR statements, but I can see it raising issues, for one, saying condition1 = 1 OR (condition1 = 2 AND condition2 = 1) is different form saying (condition1 = 1 OR condition1 = 2) AND condition2 = 1

There is, however, an easy way around the problem you describe by simply duplicating the question with separate conditions,

so instead of having

condition1 = 1 OR (condition1 = 2 AND condition2 = 1)

what you would have is

question (X) only if condition1 = 1

question (X) only if condition1 = 2 AND condition2 = 1

If what you were trying to achieve was

(condition1 = 1 OR condition1 = 2) AND condition2 = 1

Then that can be replaced by

question (X) only if condition 1=1 AND condition 2=1

question (X) only if condition 1=2 AND condition 2=1

If this type of conditions is not repeated 100 times, then duplicating the question is not a big issue.

Hope it all makes sense!

Patrick

···

On Mon, Jan 28, 2013 at 9:47 AM, Mario Molina mariom...@gmail.com wrote:

Dear all

I’m trying to use a skip at 2 different levels. This is how it looks:

condition1 = 1 OR condition1 = 2 AND condition2 = 1

Kobo allows me to use only AND or only OR when writing the code, but it doesn’t allow me to combine “AND” and “OR” in a specific skip, as showed above in the condition’s sentence. In my survey, condition1 and condition2 corresponds to two differents questions. And although I wrote this code as a hand code, it doesn’t work. I also tried to separate condition1 from condition2 as follows:

(condition1 = 1 OR condition1 = 2) AND condition2 = 1

but it still doesn’t work.

Have you any thought to fix this?

Thanks a lot!

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+unsu...@googlegroups.com.

To post to this group, send email to
kobo-...@googlegroups.com.

Visit this group at
http://groups.google.com/group/kobo-users?hl=en
.

For more options, visit
https://groups.google.com/groups/opt_out
.

You received this message because you are subscribed to the Google Groups “Kobo Users” group.

To post to this group, send email to
kobo-...@googlegroups.com.

To unsubscribe from this group, send email to
kobo-users+unsu...@googlegroups.com.

Visit this group at http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

Nice idea, Patrick!

~Neil

Hi Patrick and Neil

Thank you for your comments, especially for the Patrick’s great idea.

After trying a while, the brackets finally worked. The problem I had was that I wrote one of the brackets in a incorrect position (after the “/” sign instead of before).

Anyway, even though my survey can be read by KoBo and I can move ahead through my survey, I still have a little problem. Once I have reached the question with the conditional presented before, I cannot go back without being removed from KoBo. Then I can restart KoBo from any question I choose with no problem. But tough not essential, I have been wondering why this could happen.

I am attaching my .xml file. Questions are in Spanish, so sorry about that.

all the best!

Mario

previo.xml (42.9 KB)

···

On 28 January 2013 19:43, Neil Hendrick Neil.H...@kobotoolbox.org wrote:

~Neil

Nice idea, Patrick!

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 http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

Sorry, I forgot to mention that questions using the previous conditionals are A79, A119, and A102.

best!

Mario

···

On 29 January 2013 10:07, Mario Molina mimo...@uc.cl wrote:

Hi Patrick and Neil

Thank you for your comments, especially for the Patrick’s great idea.

After trying a while, the brackets finally worked. The problem I had was that I wrote one of the brackets in a incorrect position (after the “/” sign instead of before).

Anyway, even though my survey can be read by KoBo and I can move ahead through my survey, I still have a little problem. Once I have reached the question with the conditional presented before, I cannot go back without being removed from KoBo. Then I can restart KoBo from any question I choose with no problem. But tough not essential, I have been wondering why this could happen.

I am attaching my .xml file. Questions are in Spanish, so sorry about that.

all the best!

Mario

On 28 January 2013 19:43, Neil Hendrick Neil.H...@kobotoolbox.org wrote:

~Neil

Nice idea, Patrick!

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 http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

Mario,

There is a wonderful tool that can help you when there is something weird in your XML but you can’t find it. ODK Validate will read your XML and find errors. You can get it here:

Sometimes your XML will load OK, but then crash. This is because of some minor, not major, issue in your XML.
it looks like your XML is a little non-standard because you wrote it by hand instead of using KoBoForm.

I notice that in the BIND there are 13 instances where type="" .

When I run this through the XML validator, it notices a few other things. “Unrecognized attributes” are usually not a thing that will make your form crash, but “Group has no children!” is bad, and so is “unrecognized data type”. Go through your XML and rectify these issues and you will find your form will work better. There should be no issue with going back and forth between questions, that’s a flaw you have to fix. You get those sorted out and you’ll be fine.

~Neil Hendrick
KoBo Developer.

···

On 28 January 2013 19:43, Neil Hendrick Neil.H...@kobotoolbox.org wrote:

~Neil

Nice idea, Patrick!

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 http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

Thank you, Neil! I just downloaded the Validator and will look for those errors.

···

On 29 January 2013 13:36, Neil Hendrick neil.h...@kobotoolbox.org wrote:

Mario,

There is a wonderful tool that can help you when there is something weird in your XML but you can’t find it. ODK Validate will read your XML and find errors. You can get it here:

Sometimes your XML will load OK, but then crash. This is because of some minor, not major, issue in your XML.
it looks like your XML is a little non-standard because you wrote it by hand instead of using KoBoForm.

I notice that in the BIND there are 13 instances where type="" .

When I run this through the XML validator, it notices a few other things. “Unrecognized attributes” are usually not a thing that will make your form crash, but “Group has no children!” is bad, and so is “unrecognized data type”. Go through your XML and rectify these issues and you will find your form will work better. There should be no issue with going back and forth between questions, that’s a flaw you have to fix. You get those sorted out and you’ll be fine.

~Neil Hendrick
KoBo Developer.

On Tue, Jan 29, 2013 at 8:07 AM, Mario Molina mimo...@uc.cl wrote:

Hi Patrick and Neil

Thank you for your comments, especially for the Patrick’s great idea.

After trying a while, the brackets finally worked. The problem I had was that I wrote one of the brackets in a incorrect position (after the “/” sign instead of before).

Anyway, even though my survey can be read by KoBo and I can move ahead through my survey, I still have a little problem. Once I have reached the question with the conditional presented before, I cannot go back without being removed from KoBo. Then I can restart KoBo from any question I choose with no problem. But tough not essential, I have been wondering why this could happen.

I am attaching my .xml file. Questions are in Spanish, so sorry about that.

all the best!

Mario

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 http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

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 http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

On 28 January 2013 19:43, Neil Hendrick Neil.H...@kobotoolbox.org wrote:

~Neil

Nice idea, Patrick!

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 http://groups.google.com/group/kobo-users?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.