# Generate sequential ID based on pulled data

**URL:** <https://forum.getodk.org/t/generate-sequential-id-based-on-pulled-data/49408>\
**Category:** Support\
**Tags:** entities, form-design, odk-xlsform\
**Created:** [September 10, 2024, 9:47am UTC](https://forum.getodk.org/t/generate-sequential-id-based-on-pulled-data/49408 "2024-09-10T09:47:52Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [September 25, 2024, 9:14am UTC](https://forum.getodk.org/t/generate-sequential-id-based-on-pulled-data/49408/6 "2024-09-25T09:14:35Z")

</div>

> [@joybindroo](#):
>
> It is also crucial to ensure that the external dataset is being updated accurately for future rounds of the census.

Instead of using manual updates, consider using [Entities](https://docs.getodk.org/entities-intro/) which let you share data between forms. You can think of an Entity List as a CSV attachment that's shared between forms and can be updated by form submissions.

To generate sequential ids, you could use a household Entity List that keeps track of the highest participant ID assigned within that household as @joybindroo suggests. Submissions can then automatically update that highest ID. You can use `pulldata` in the same way as described.

Another option would be to use a participant Entity List that keeps track of each participant, the household that they're in, and their number in the household. You can then use the `max` function to get the highest participant id used so far and use it as the basis for the next participant id. This would be a good approach if you also want to use participant information such as their name in future follow-up forms.

Let us know if it would be helpful to see a worked example for one or both options.

Currently, Entity updates require getting a form update from the server but soon they will [happen offline as well](https://forum.getodk.org/t/collect-coming-soon-offline-entities/46505). That means you could generate sequential IDs for two participants in the same household that you visit one after the other without connecting to the server in between.

---

_[View the full topic](https://forum.getodk.org/t/generate-sequential-id-based-on-pulled-data/49408)._
