ODK Validate Error

135
2
04-12-2021 05:32 AM
JustinCallahan
New Contributor

Survey123Er.pngSurvey123Q.png

So basically what I'm trying to enable in my form is the ability to auto-populate the project name if someone knows the project ID and vice versa. They work individually, but I get the dependency error when I try to implement both and I sort of understand why that's happening, I just don't know the workaround here. I've read about using if statements so any help would be most appreciated. Thank you.

0 Kudos
2 Replies
Philip-Wilson
Esri Frequent Contributor

Hi @JustinCallahan,

This error occurs when there is a dependency cycle between the questions and values that are being used in your expressions, for one expression to work it relies on the value from the previous expression, but you are trying to calculate that using the expression it is referring too.

The same issue will happen in Excel calculations and other formula/coding software when you create a dependency cycle between two values that refer to each other.

You will need to adjust your expressions to not reply on questions/values that refer to each other.

Regards,

Phil.

0 Kudos
Jim-Moore
Esri Regular Contributor

Hi @JustinCallahan further to @Philip-Wilson's comments, one method that might be useful in this case is to use the autocomplete appearance on a select_one_from_file question. If the 'label' field in your CSV includes both the project ID and the project name as one string (you could concatenate the two together, e.g. "A12345-Project Name 1"), users will be able to search for either the project ID or project name in the one question. You could then have the project ID as the 'name', so that would get stored in the select_one_from_file question; and then in a separate hidden question retrieve the project name from another column in the CSV. So your CSV might look something like:

name,label,ProjectName
A12345,A12345-The Main Project,The Main Project
B34211,B34211-Another Project Name,Another Project Name
C49592,C49592-Project Number 3,Project Number 3
...etc...

Hope this helps. Best, Jim

0 Kudos