Skip Logic within Repeat

569 views
Skip to first unread message

Dustin Locke

unread,
Aug 13, 2012, 1:24:40 AM8/13/12
to kobo-...@googlegroups.com
Hey community,
I think I have figured out how to get the skip logic to work within the a repeat groups, but I would like to hear what your opinions are on the topic.
I have to go into the code, and the only thing that I can find that dictates the skip feature is in the <instance> region. Is the only thing I have to do is write the relevant = command at the end of the instance? Is there any other call outs that I need to be aware of to make this work? Does the repeat command come before the relevant = command or vice versa, or does it matter?
Ok I am going to try this out and hope for the best.
Hope to hear from someone soon.
Survey starts next Sunday in the Whitechapel district of London..

Cheers

Dustin

Neil Hendrick

unread,
Aug 13, 2012, 10:59:05 AM8/13/12
to kobo-...@googlegroups.com
Dustin,
it's pretty easy to make an error, since any space or misplaced semicolon with cause a failure.
So, good news and bad news...
Good News: the new KoBoForm has all this automated so you don't have to do it by hand anymore. Check it out: http://www.kobotoolbox.org/updates/2012/08/new-improved-repeating-groups

Bad News: You've already done all the work. It should be easier to just fix your survey than start all over, why don't you attach the form and send it this way. We will take a look at it and see what the issue is.

~Neil Hendrick
KoBo Developer



Dustin

--
You received this message because you are subscribed to the Google Groups "Kobo Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/kobo-users/-/qpeBUu7HbmoJ.
To post to this group, send email to kobo-...@googlegroups.com.
To unsubscribe from this group, send email to kobo-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/kobo-users?hl=en.

remyclem

unread,
Aug 14, 2012, 11:48:45 AM8/14/12
to kobo-...@googlegroups.com
Hello and thank you for this incredibly great work ! Excuse my bad english ... i'm french :-)
I try to make a survey where a repeat section come only when i answer another question (Skip logic condition). 
I try that :
  1. I used the KoboForm you link and follow the guide. I try to insert a skip logic condition on my group element but there's systematicely this error : (TypeError): Cannot call method 'Hk' of null
  2. I used the KoboForm too, and try to put skip logic condition on the repeat section element. My xml save is ok but don't work. The repeat section come at all time.
  3. I used the Koboform too, suppr the group element, only put the repeat section element and put the skip logic condition. Same result.
  4. I used the Koboform too, only put a repeat section element and put the skip logic condition to the repeat section and all the questions inside it. Same result.
  5. So I edit the xml, and I had a nodeset for the repeat section (The Form don't do that, for a good reason i think but ...), and of course i put a "relevant" condition for this nodeset. On the smarphone it's a perfect result. All gone good in the survey (i join it in zip in this mail). Unfortunately when i synchronize my surveys, i do not aggregate the datas of the questions inside the repeat section (i use ODK aggregate 1.2.0, and whitout skip logic it works fine with kobo repeat sections).
Do you have some ideas to help me ?
Big thanks in advance,

I want to add something out of the subject. With this new KoboForm there is something wrong with the "Hint" text. The XML generation don't put some "<text id></text> with the texte value, so an error occur in ODK collect app because there's the <hint ref> but not the text to put. I hope it can help.

Rémy CLEMENT
(GIS administrator in environnemental projects)

Linking files don't work in my mail so i paste my xml code juste here :

<?xml version="1.0" encoding="UTF-8"?>
  <h:head>
    <h:title ref="jr:itext('test')">test</h:title>
    <model>
      <instance>
        <test id="test">
          <A01/>
          <A04 jr:template="">
            <A04_01/>
            <A04_02/>
          </A04>
          <A05/>
        </test>
      </instance>
      <bind id="A01" nodeset="/test/A01" type="xsd:string" required="true()"/>
 <bind id="A04" nodeset="/test/A04" type="xsd:string" required="true()" relevant="/test/A01 = '1'"/>
 <bind id="A04_01" nodeset="/test/A04/A04_01" type="xsd:string" required="true()"/>
      <bind id="A04_02" nodeset="/test/A04/A04_02" type="xsd:string" required="true()"/>
      <bind id="A05" nodeset="/test/A05" type="" required="true()"/>
      <itext>
        <translation lang="English">
          <text id="test">
            <value>test</value>
          </text>
          <text id="A01">
            <value>Lancement</value>
          </text>
          <text id="A01_1">
            <value>Oui vas-y</value>
          </text>
          <text id="A01_2">
            <value>non non</value>
          </text>
          <text id="A04">
            <value>Donne ton avis</value>
          </text>
          <text id="A04_01">
            <value>alors ?</value>
          </text>
          <text id="A04_02">
            <value>resultats</value>
          </text>
          <text id="A04_02_1">
            <value>oui</value>
          </text>
          <text id="A04_02_2">
            <value>non</value>
          </text>
          <text id="A04_02_3">
            <value>peut-etre</value>
          </text>
          <text id="A05">
            <value>Informations pour toi</value>
          </text>
 <text id="A05-hint">
            <value>coucou</value>
          </text>
        </translation>
      </itext>
    </model>
  </h:head>
  <h:body>
    <select1 bind="A01">
      <label ref="jr:itext('A01')"/>
      <item>
        <label ref="jr:itext('A01_1')"/>
        <value>1</value>
      </item>
      <item>
        <label ref="jr:itext('A01_2')"/>
        <value>2</value>
      </item>
    </select1>
    <group id="A04">
      <label ref="jr:itext('A04')"/>
      <repeat nodeset="/test/A04">
        <input bind="A04_01">
          <label ref="jr:itext('A04_01')"/>
        </input>
        <select1 bind="A04_02">
          <label ref="jr:itext('A04_02')"/>
          <item>
            <label ref="jr:itext('A04_02_1')"/>
            <value>1</value>
          </item>
          <item>
            <label ref="jr:itext('A04_02_2')"/>
            <value>2</value>
          </item>
          <item>
            <label ref="jr:itext('A04_02_3')"/>
            <value>3</value>
          </item>
        </select1>
      </repeat>
    </group>
    <trigger bind="A05">
      <label ref="jr:itext('A05')"/>
      <hint ref="jr:itext('A05-hint')"/>
    </trigger>
  </h:body>
</h:html>

Bernard Lukwiya

unread,
Jan 30, 2013, 9:00:41 AM1/30/13
to kobo-...@googlegroups.com
Dear All,

Same old problem with skip logic, has anybody found out how to do this. I have tried about 5 times, each time creating a new form but I still get the same error (Not a valid question) see attached. 

I have uploaded both my xml and the screenshots of the error I receive. Once I click okay, select my logic question, the answers don't show. 

I want to apply the skip logic on the next question appear(and prompt for price) If the item was sold. 

Please help!!!

Bernard. 
Skipv6.xml.xml
Skip_Logic_Error.pdf

Neil Hendrick

unread,
Jan 30, 2013, 10:40:55 AM1/30/13
to kobo-...@googlegroups.com
Bernard,
After loading your form, i confirm your issue. Thanks for including your XML and a screenshot of the error, very helpful! We've made some improvements to the handling of skip logic within groups, but I will have to dig into this. Let me get back to you with a solution.

~Neil

--
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.

Neil Hendrick

unread,
Jan 30, 2013, 2:14:18 PM1/30/13
to kobo-...@googlegroups.com
Bernard,
This is a great question, and it gives a look inside the slightly more complex skip logic required for operating within a repeating group.
I will explain here in some detail how this works.

First off, yes, there was a flaw in KoBoForm's working with skip logic inside repeating groups, so kudos to the KoBoNauts who found this and brought it to the developer's attention. We are fixing this right now and will push the changes to the online KoBoForm asap. The problem is with KoboForm not liking a question from a repeat as the value for another repeat question's relevant.

Bernard has a repeating group, and inside that group, there is a questions that is only answered if the previous question's answer = 3.
The skip logic for this should look like:

<bind id="A05_06" nodeset="/NFI_Tracking/A05/A05_06" type="xsd:int" required="true()" relevant="/NFI_Tracking/A05/A05_05 = '3'"/>

The most important part is the relevant="" statement, which controls the skip logic.

relevant="/NFI_Tracking/A05/A05_05 = '3'

If you ever want to customize the skip logic in a way that KoBoForm doesn't do automatically, there is a great feature for Hand Coding the skip logic. You just check the "Hand Code" box, and then you will get an open text box. You write in there whatever skip logic would go in between the quotes from relevant="..." Be sure to use a full Xpath expression starting with /.
Like this:
/Instance/Group/Question = 'value'



This function allows you to get around errors as well as do more creative things with your Skip Logic. If you want to learn more clever things to do with Skip Logic see the user guide.

Bernard should try that for getting around this issue today, but the fix should be up very quickly and you won't have to worry about it anymore.

Best,

Neil Hendrick

Bernard Lukwiya

unread,
Feb 5, 2013, 4:30:05 AM2/5/13
to kobo-...@googlegroups.com
Hendrick,

I hope you are well.

I know you are really busy, please let me know if you have found the solution around the problem below. I have tried contacting several other developers who confirm the problem but no solution has yet been found.

With you wide contacts, if you like, share the documents and the problem to the a larger audience in any community you can like. The information provided is not confidential! With several brains working on this, I hope this will be fixed sooner than later.

Best,

Bernard. 
Reply all
Reply to author
Forward
0 new messages