# First time user - Create a restriction

**URL:** <https://forum.getodk.org/t/first-time-user-create-a-restriction/4371>\
**Category:** Support\
**Created:** [May 25, 2015, 6:07pm UTC](https://forum.getodk.org/t/first-time-user-create-a-restriction/4371 "2015-05-25T18:07:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tjms1989](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@Tjms1989](https://forum.getodk.org/u/Tjms1989)\
**Post date:** [May 25, 2015, 6:07pm UTC](https://forum.getodk.org/t/first-time-user-create-a-restriction/4371/1 "2015-05-25T18:07:11Z")

</div>

Hi,

I am first time user. I need help with something I think I am not  
understanding about ODK.

What I would like to do is to allow only people who fulfull one condition  
to continue with the survey. This condition has to do with two variables,  
one integer number (bigger than 1 million, called _"id"_) and one text  
variable (one digit, called _"v"_).

Specifically, what I want to do is:  
-Take the first digit of the integer number _id_ (for example if it is  
26.928.928 take the 2)  
-Multiply it by 4 (2\*4=8)  
-Divided it by 3. (8/3)  
-Calculate the remainder (2). The answer could be either 0,1 or 2.

If is different from 2, then the righ answers for v is 2.  
If is 0 or 1, the right answer for v is x.

_I would like to allow to the survey continue only people with the right  
answer in "v"._

For the moment, I am creating a calculation row in the same page, "v2",  
that has, in the calculation value, the next (i am using surveycto):

if(((int(substr(string(${rut}), 0,1)))\*4 mod 3)!=2,.=2,.=x)

But It appears that "Dependency cycles amongst the xpath expressions in  
relevant/calculate", so I am not doing it right.

_-Do you know why the expression is not working?_  
\*-If it works, I imagine that it would create a new variable with the  
results of the expression (2 where the reminder is different from 2 and x  
if the result is \*  
_2). How can I manage to stop the survey if this "v2" is different from  
"v"?_

_Thanks a lot!_

---

<div class="post-metadata">

**Author:** ![Mitch\_S](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@Mitch\_S](https://forum.getodk.org/u/Mitch_S)\
**Post date:** [May 27, 2015, 5:45pm UTC](https://forum.getodk.org/t/first-time-user-create-a-restriction/4371/2 "2015-05-27T17:45:48Z")

</div>

You will get more assistance if you attach an example XLSX file with just  
this portion of your form's logic. Reading your question, I have no idea  
where "x" came in.

> **···**
>
> On Mon, May 25, 2015 at 11:07 AM, wrote:
> 
> > Hi,
> > 
> > I am first time user. I need help with something I think I am not  
> > understanding about ODK.
> > 
> > What I would like to do is to allow only people who fulfull one condition  
> > to continue with the survey. This condition has to do with two variables,  
> > one integer number (bigger than 1 million, called _"id"_) and one text  
> > variable (one digit, called _"v"_).
> > 
> > Specifically, what I want to do is:  
> > -Take the first digit of the integer number _id_ (for example if it is  
> > 26.928.928 take the 2)  
> > -Multiply it by 4 (2\*4=8)  
> > -Divided it by 3. (8/3)  
> > -Calculate the remainder (2). The answer could be either 0,1 or 2.
> > 
> > If is different from 2, then the righ answers for v is 2.  
> > If is 0 or 1, the right answer for v is x.
> > 
> > _I would like to allow to the survey continue only people with the right  
> > answer in "v"._
> > 
> > For the moment, I am creating a calculation row in the same page, "v2",  
> > that has, in the calculation value, the next (i am using surveycto):
> > 
> > if(((int(substr(string(${rut}), 0,1)))\*4 mod 3)!=2,.=2,.=x)
> > 
> > But It appears that "Dependency cycles amongst the xpath expressions in  
> > relevant/calculate", so I am not doing it right.
> > 
> > _-Do you know why the expression is not working?_  
> > \*-If it works, I imagine that it would create a new variable with the  
> > results of the expression (2 where the reminder is different from 2 and x  
> > if the result is \*  
> > _2). How can I manage to stop the survey if this "v2" is different from  
> > "v"?_
> > 
> > _Thanks a lot!_
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Mitch Sundt  
> Software Engineer  
> University of Washington  
> [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)
