Running into an issue where i seem to be unable to use indexed-repeat twice in an if statement. I have tried a couple of different ways around as shown below:
if( string-length(indexed-repeat(${field2}, ${repeat}, 1)) > 0, indexed-repeat(${field2}, ${repeat}, 1), 'UTP') |
if( indexed-repeat(${field1}, ${repeat}, 1) = 'UTP', 'UTP', indexed-repeat(${field2}, ${repeat}, 1)) |
When saving the xls form i don't get any errors but when looking at the fields in the survey, it throws an error and just shows the calculation as opposed to the desired result.
Any ideas? is there a limit on using indexed-repeat in if statements?
Cheers
Solved! Go to Solution.
Several statements get confused when nested in a if. Break it out into its own field then reference that in the if.
Does it work without the if statement?
Can you share your xlsform?
Are you putting this within the repeat you are referencing? That won't work at all
Several statements get confused when nested in a if. Break it out into its own field then reference that in the if.
I second splitting that calculation up. All distinct operations diverse their own distinct line/calculate. While you can sometimes get away with combining operations, I would try and not make a habit of it.
I ended up splitting them out and it worked however it's meant tripling the number of fields i need to have, wishing esri would solve the indexing within a repeat, would save so much effort, in this case i have one field showing a rolling average value across repeats, and i need 95 fields to calculated it over my prescribed number of tests.