# Randomly select a name from age group (under 5, 5-15, over 15 )

**URL:** <https://forum.getodk.org/t/randomly-select-a-name-from-age-group-under-5-5-15-over-15/20696>\
**Category:** Support\
**Tags:** odk-xforms\
**Created:** [July 1, 2019, 8:14pm UTC](https://forum.getodk.org/t/randomly-select-a-name-from-age-group-under-5-5-15-over-15/20696 "2019-07-01T20:14:27Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [July 1, 2019, 11:50pm UTC](https://forum.getodk.org/t/randomly-select-a-name-from-age-group-under-5-5-15-over-15/20696/4 "2019-07-01T23:50:07Z")

</div>

You can absolutely do this kind of thing with the ODK form specification! Unfortunately, XLSForm doesn't make that super obvious but you can write [XPath expressions](https://en.wikipedia.org/wiki/XPath) within an XLSForm.

[This form](https://docs.google.com/spreadsheets/d/1tqqEIdBKU-qk-3flgidqWun17ntSoTZYdSxdX7J5HcA/edit#gid=0) shows an example that you can hopefully follow to get to your desired behavior. I used XPath syntax where necessary for filtering and XLSForm's compact `${}` syntax elsewhere. I hope it's clear enough that you can pattern match without necessarily understanding all the details.

---

_[View the full topic](https://forum.getodk.org/t/randomly-select-a-name-from-age-group-under-5-5-15-over-15/20696)._
