# How can I retrieve value selected from lookup table

**URL:** <https://forum.dimagi.com/t/how-can-i-retrieve-value-selected-from-lookup-table/12051>\
**Category:** Users\
**Created:** [October 18, 2025, 10:25am UTC](https://forum.dimagi.com/t/how-can-i-retrieve-value-selected-from-lookup-table/12051 "2025-10-18T10:25:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bekethio](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/b/f14d63/32.png) [@Bekethio](https://forum.dimagi.com/u/Bekethio)\
**Post date:** [October 18, 2025, 10:25am UTC](https://forum.dimagi.com/t/how-can-i-retrieve-value-selected-from-lookup-table/12051/1 "2025-10-18T10:25:13Z")

</div>

I want to use the previously answer from tookup table to use on the next question or to display the value. It display the id value in the lookup table.  
1st. It put this xpath next question "#form/organization\_to\_zone/region\_address" but display the id for selected value.

2nd. use hidden question and put this in calcuation  
”instance('region')/region\_list/region[@id = #form/organization\_to\_zone/region\_address]/name”  
However, there is another error stating that  
“Calculation Error: Error in calculation for /data/organization\_to\_zone/selected\_regster1 XPath nodeset has more than one node”  
Is there anyone who faced this type of problem and solve it. I appreciate your support

---

<div class="post-metadata">

**Author:** ![Mazz](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/mazz/32/1004_2.png) [@Mazz](https://forum.dimagi.com/u/Mazz)\
**Post date:** [October 20, 2025, 8:14am UTC](https://forum.dimagi.com/t/how-can-i-retrieve-value-selected-from-lookup-table/12051/2 "2025-10-20T08:14:54Z")

</div>

if your question is in a repeat group, you need to resolve to a single value - look into using current() and position() functions

if not, look into you lookup table data. there’s more than one row with that id

---

<div class="post-metadata">

**Author:** ![Bekethio](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/b/f14d63/32.png) [@Bekethio](https://forum.dimagi.com/u/Bekethio)\
**Post date:** [October 23, 2025, 7:01am UTC](https://forum.dimagi.com/t/how-can-i-retrieve-value-selected-from-lookup-table/12051/3 "2025-10-23T07:01:52Z")

</div>

Hi Mazz,

Thank you so much for your guideline. I applied not in repeat group and also my lookup table doesn’t have duplicate data however I can’t get the name value from lookup table.  
when I use "#form/organization\_to\_zone/region\_address" it retrieve Id from lookup table. Is there and xpath code to retreive the name other than I used.

Thank you

---

<div class="post-metadata">

**Author:** ![Mazz](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/mazz/32/1004_2.png) [@Mazz](https://forum.dimagi.com/u/Mazz)\
**Post date:** [October 23, 2025, 8:09am UTC](https://forum.dimagi.com/t/how-can-i-retrieve-value-selected-from-lookup-table/12051/4 "2025-10-23T08:09:11Z")

</div>

> [@Bekethio](#):
>
> #form/organization\_to\_zone/region\_address

this will return the saved value not the pretty name

if region\_address is a lookup table, you will always get the saved value - your lookup table can look different, so the pretty name can be in a different column than “name”.

so if the column that the lookup table saves is under name, you want to get another column for the pretty value. maybe “display text” or whatever your structure looks like.

instance('region')/region\_list/region[@id = #form/organization\_to\_zone/region\_address]/display\_name or whatever your table looks like.

you can also put a join() around that code to see which values are being pulled back and avoid that error. that error is 100% happening because it is expecting one vaue somewhere, and it is getting more than one. it is either your question (I doubt that) or your lookup table rows that are coming back more than 1.

so

join(“ “, instance('region')/region\_list/region[@id = #form/organization\_to\_zone/region\_address]/name)

---

<div class="post-metadata">

**Author:** ![Eris\_Casper](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/e/54ee81/32.png) [@Eris\_Casper](https://forum.dimagi.com/u/Eris_Casper)\
**Post date:** [April 2, 2026, 11:47am UTC](https://forum.dimagi.com/t/how-can-i-retrieve-value-selected-from-lookup-table/12051/6 "2026-04-02T11:47:12Z")

</div>

Retrieving values from a lookup table in CommCare can be a bit tricky with the syntax, but it's super powerful once you get the hang of it. The key is usually making sure your instance path is exactly right in the XPath expression. A common way to do this is using a hidden action or a calculation field with a formula like instance('item-list:your\_table\_id')/your\_table\_list/item[id = #form/selected\_id]/value\_to\_retrieve.

If you're still seeing a blank result, double-check that the "ID" field in your lookup table matches the "Value" (not the Label) of the question where the user is making the selection. Also, sometimes a quick "Refresh" of the app in the HQ helps if you've recently updated the table data.
