# Generate an automatic consecutive, using begin\_repeat and begin\_group

**URL:** <https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861>\
**Category:** Support\
**Created:** [January 4, 2021, 3:59am UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861 "2021-01-04T03:59:03Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fredy\_Angarita](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/fredy_angarita/32/14178_2.png) [@Fredy\_Angarita](https://forum.getodk.org/u/Fredy_Angarita)\
**Post date:** [January 4, 2021, 3:59am UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861/1 "2021-01-04T03:59:03Z")

</div>

**1. What is the problem? Be very detailed.**  
I want to automatically generate a consecutive number  
**2. What app or server are you using and on what device and operating system? Include version numbers.**  
XLSForm Online v2.3.3  
**3. What you have you tried to fix the problem?**  
I have read and tried [https://docs.getodk.org/form-logic/#requiring-responses](https://docs.getodk.org/form-logic/#requiring-responses)  
**4. What steps can we take to reproduce the problem?**  
Sorry, I don't speak English well but I need help  
**5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.**  
[prueba plantilla.xlsx](https://forum.getodk.org/uploads/short-url/xIbwrKmxQ7WHJN4bBSf9b6u0SPd.xlsx) (12.4 KB)

---

<div class="post-metadata">

**Author:** ![Grzesiek2010](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/grzesiek2010/32/2881_2.png) [@Grzesiek2010](https://forum.getodk.org/u/Grzesiek2010)\
**Post date:** [January 4, 2021, 9:06am UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861/2 "2021-01-04T09:06:16Z")

</div>

Hi @Fredy_Angarita  
We're glad you're here. When you get a chance, please [introduce yourself on this forum thread](https://forum.getodk.org/t/-/6671). I'd also encourage you to add a real picture as your avatar because it helps build community!

how about a solution like this:  
[prueba plantilla.xlsx](https://forum.getodk.org/uploads/short-url/esN4CPxcoTbHZjhUcHHTCHAWCHy.xlsx) (9.1 KB)

---

<div class="post-metadata">

**Author:** ![Fredy\_Angarita](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/fredy_angarita/32/14178_2.png) [@Fredy\_Angarita](https://forum.getodk.org/u/Fredy_Angarita)\
**Post date:** [January 5, 2021, 1:18am UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861/3 "2021-01-05T01:18:23Z")

</div>

Thank you very much @Grzesiek2010  
It has worked for me.  
Can a modification be made? I want it to follow the consecutive, but from a number that the pollster enters in the form, other than from number 1, for example:  
Pollster enters the number 4, from there the consecutive number begins, 5, 6, 7… n

---

<div class="post-metadata">

**Author:** ![Grzesiek2010](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/grzesiek2010/32/2881_2.png) [@Grzesiek2010](https://forum.getodk.org/u/Grzesiek2010)\
**Post date:** [January 5, 2021, 7:13am UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861/4 "2021-01-05T07:13:59Z")

</div>

It could be something like:  
[prueba plantilla.xlsx](https://forum.getodk.org/uploads/short-url/yBfF1mdBSAR8JGXvdTFhVTmYMBv.xlsx) (9.2 KB)

---

<div class="post-metadata">

**Author:** ![Fredy\_Angarita](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/fredy_angarita/32/14178_2.png) [@Fredy\_Angarita](https://forum.getodk.org/u/Fredy_Angarita)\
**Post date:** [January 5, 2021, 3:02pm UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861/5 "2021-01-05T15:02:05Z")

</div>

Thank you very much for the solution,  
Would it be possible not to use the "baseNumber" question?  
Let the consecutive number start from the number that the pollster places, but in the question “nro\_individuo”.  
In other words, the initial number of the consecutive number that the pollster places, places it in the question "individual\_no", without creating the variable "baseNumber"

---

<div class="post-metadata">

**Author:** ![Grzesiek2010](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/grzesiek2010/32/2881_2.png) [@Grzesiek2010](https://forum.getodk.org/u/Grzesiek2010)\
**Post date:** [January 5, 2021, 3:52pm UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861/6 "2021-01-05T15:52:22Z")

</div>

I'm not sure if I understand so you want that number to be hardcoded in the form not passed by an enumerator?

---

<div class="post-metadata">

**Author:** ![Fredy\_Angarita](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/fredy_angarita/32/14178_2.png) [@Fredy\_Angarita](https://forum.getodk.org/u/Fredy_Angarita)\
**Post date:** [January 5, 2021, 4:18pm UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861/7 "2021-01-05T16:18:23Z")

</div>

Sorry, I don't speak English well.  
I want the enumerator to enter the initial number in the question "nro\_individuo" and generate a consecutive number from the number that the enumerator entered, that is, without creating the question "baseNumber"

---

<div class="post-metadata">

**Author:** ![Grzesiek2010](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/grzesiek2010/32/2881_2.png) [@Grzesiek2010](https://forum.getodk.org/u/Grzesiek2010)\
**Post date:** [January 7, 2021, 8:58am UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861/8 "2021-01-07T08:58:49Z")

</div>

It's not trivial because then you would need `nro_individuo` to be calculated but not i the first group what is not possible because if a question has calculation it's always calculated.

---

<div class="post-metadata">

**Author:** ![Fredy\_Angarita](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/fredy_angarita/32/14178_2.png) [@Fredy\_Angarita](https://forum.getodk.org/u/Fredy_Angarita)\
**Post date:** [January 7, 2021, 2:18pm UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861/9 "2021-01-07T14:18:07Z")

</div>

Understood, thanks for the explanation.  
Could it be otherwise?  
In the Docs I found an example and it works, but without the Begin\_group.  
[prueba plantilla\_NO\_Begin\_group.xlsx](https://forum.getodk.org/uploads/short-url/mAERwEfzHY8GunLN0g6yBxkczyP.xlsx) (12.2 KB)  
But I need it with the Begin\_group. When including the Begin\_group, the consecutive does not work.  
[prueba plantilla.xlsx](https://forum.getodk.org/uploads/short-url/uKgqOYahwpd78YPQW0MAUGkiSfO.xlsx) (12.4 KB)

---

<div class="post-metadata">

**Author:** ![Grzesiek2010](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/grzesiek2010/32/2881_2.png) [@Grzesiek2010](https://forum.getodk.org/u/Grzesiek2010)\
**Post date:** [January 8, 2021, 12:02pm UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861/10 "2021-01-08T12:02:27Z")

</div>

With defaults it is possible but you need to handle that inner group so it should look like:  
[prueba plantilla.xlsx](https://forum.getodk.org/uploads/short-url/imizzpB3Wx1TRQBYapuKBvYsL6V.xlsx) (9.1 KB)

---

<div class="post-metadata">

**Author:** ![Fredy\_Angarita](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/fredy_angarita/32/14178_2.png) [@Fredy\_Angarita](https://forum.getodk.org/u/Fredy_Angarita)\
**Post date:** [January 8, 2021, 12:54pm UTC](https://forum.getodk.org/t/generate-an-automatic-consecutive-using-begin-repeat-and-begin-group/31861/11 "2021-01-08T12:54:30Z")

</div>

Thank you very much @Grzesiek2010, this is what I want. With the previous answers, I learned a lot. You're very kind.
