XLSForm ${} substitution not working

Hi Everyone,

I have created a calculated variable whose response is used in subsequent questions. For some reason, the response won't appear in any of the questions. To test my calculation, I created a 'dummy' text response with the subsititution and it worked just fine, so I can't figure out what's going on. I've provided a very shortened example of the issue attached. stattoken is the calculated variable, 'teststattoken' was my dummy variable where the subsitution works perfectly. 'reason_provider' is an example where the substitution token isn't working (i've used it in ~15 variables and none of them work). Any insights are greatly appreciated!


Example for Forum.xlsx (15.8 KB)

ODK v1.11, but using Enketo to validate and haven't tried on the tablet yet

Thanks for providing a form that hones in on the problem, @AMARR! That really helps with troubleshooting. I modified it a little further to add a gender field so I could try it out - substitution.xlsx (6.2 KB). It works as intended on Collect.

Is it possible that your gender field is a select_one? If so, keep in mind that its value may not be the same as its label and that you are comparing the value. Additionally, the test is case-sensitive so if it's an open field you need to make sure enumerators enter lowercase values.

Thanks for your response. What is strange is that it works fine for the
text variable 'teststattoken' i created, but not in any of the later
questions. This suggests to me that the coding for stattoken is fine and
calling up the proper points. There must be something else happening where
it can't recall it later in the survey. I, unfortunately, can't share the
full file but hopefully will figure it out!


Update: I got it to work. I think the problem was I was moving to fast for
Enketo. Once I went through the whole survey, by the time I got down to the
section they were originally missing from, they were there. I'm guessing in
my rush to solve this problem, I wasn't waiting for the substitutions to

Thanks HM!


1 Like