# Referencing values in internal datasets

**URL:** <https://forum.getodk.org/t/referencing-values-in-internal-datasets/36874>\
**Category:** Support\
**Tags:** odk-xlsform\
**Created:** [February 28, 2022, 11:07pm UTC](https://forum.getodk.org/t/referencing-values-in-internal-datasets/36874 "2022-02-28T23:07:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkuester](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/jkuester/32/15913_2.png) [@jkuester](https://forum.getodk.org/u/jkuester)\
**Post date:** [February 28, 2022, 11:07pm UTC](https://forum.getodk.org/t/referencing-values-in-internal-datasets/36874/1 "2022-02-28T23:07:48Z")

</div>

**1. What is the problem? Be very detailed.**  
I am simply trying to reference a value from the internal dataset (from `choices`) as described in [the documentation](https://docs.getodk.org/form-datasets/#referencing-values-in-datasets). However, my form fails to even load due to the error:

```auto
Error: ODK Validate Errors:
>> Something broke the parser. See above for a hint.
Error evaluating field 'pop_calc' (${pop_calc}[1]): The problem was located in Calculate expression for ${pop_calc}
XPath evaluation: Instance referenced by instance(states)/root/item/population does not exist
Caused by: org.javarosa.xpath.XPathMissingInstanceException: The problem was located in Calculate expression for ${pop_calc}
XPath evaluation: Instance referenced by instance(states)/root/item/population does not exist
	... 10 more

The following files failed validation:
${enketo_widgets}.xml

Result: Invalid

```

Clearly something is messed up with my form config, but I cannot figure out what it is since I basically just copied the example from the documentation.

[enketo\_widgets.xlsx](https://forum.getodk.org/uploads/short-url/lCC7TTPG32FPMzy89NxSHJ0XM1g.xlsx) (12.5 KB)

**2. What app or server are you using and on what device and operating system? Include version numbers.**

I am just testing the form out on [https://getodk.org/xlsform/](https://getodk.org/xlsform/)

**3. What you have you tried to fix the problem?**

I have tried various tweaks to the configuration (e.g. wrapping the whole calculation in `string`), but nothing has helped.

**4. What steps can we take to reproduce the problem?**

Use [https://getodk.org/xlsform/](https://getodk.org/xlsform/) to convert a form that contains the configuration example from the [internal dataset documentation](https://docs.getodk.org/form-datasets/#referencing-values-in-datasets).

**5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.**

Thanks!

---

<div class="post-metadata">

**Author:** ![jkuester](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/jkuester/32/15913_2.png) [@jkuester](https://forum.getodk.org/u/jkuester)\
**Post date:** [February 28, 2022, 11:10pm UTC](https://forum.getodk.org/t/referencing-values-in-internal-datasets/36874/2 "2022-02-28T23:10:57Z")

</div>

survey:

| type | name | label | calculation |
| --- | --- | --- | --- |
| select\_one states | state | State | |
| calculate | pop\_calc | Population for selected state | instance("states")/root/item[name = ${state}]/population |
| note | pop\_note | Population: ${pop\_calc} | |

choices:

| list\_name | name | label | population |
| --- | --- | --- | --- |
| states | abia | Abia | 4112230 |
| states | ebonyi | Ebonyi | 2176947 |

---

<div class="post-metadata">

**Author:** ![jkuester](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/jkuester/32/15913_2.png) [@jkuester](https://forum.getodk.org/u/jkuester)\
**Post date:** [March 1, 2022, 4:10pm UTC](https://forum.getodk.org/t/referencing-values-in-internal-datasets/36874/3 "2022-03-01T16:10:55Z")

</div>

Okay, I guess I answered my own question. What my config was missing was `true()` (or any other value?) in the `choice_filter` column for my select. For some reason this is required to cause the instance data from `choices` to be included.

There is a [note about this](https://docs.getodk.org/form-logic/#id28) buried in the documentation that indicates it is a "bug" in `pyxform`. There is more discussion on [this pyxform issue](https://github.com/XLSForm/pyxform/issues/176).
