Custom location data giving error (which is not a valid question or value)

Hi there,

I am facing an issue where I am following the instructions set out on the below page to access custom location data.

This is what happens when I load the survey:

error more or less = (which is not a valid question or value)

this is what my calculation field value looks like:
instance(‘locations-1’)/locations/location[@id = #form/QListMain/site]/location_data/testid

However if I reference site_code using this calculation I get back the expected value and it seems to work (Notice the custom id label)
instance(‘locations-1’)/locations/location[@id = #form/QListMain/site]/site_code

This is my custom location field

This is what my little survey looks like:

@Clayton_Sims I have a feeling you might have an answer for me here?


My guess is that there’s there’s an issue with the location_data part of your query.

It would probably be really helpful to use the Evaluate XPath expression tester from this tool:

and do a direct query for


to see what is inside of the data model and whether it matches what you expect within the location_data block.


I’ve actually had this “-1” pop up on its own whenever i tried this

any idea where it’s coming from?


Hi @Clayton_Sims,

I can see that the location data is there, and the custom field testid.
So I came to the conclusion that the code:
instance(‘locations-1’)/locations/location[@id = #form/QListMain/site]/location_data/testid
is actually correct then.

I randomly started fiddling and then came across setting a location for the mobile user.
I noticed that it wasnt set to anything and so I set it, and then logged back in.
As soon as I did that. It worked.
So if the mobile user has no location set this is the error that is thrown.

This is the result I got back by running the xpath evaluation: instance(‘locations-1’)/locations/location

Cape Town Hospice


Eastern Cape



East London Hospice


South Africa