I have tried many ways to trouble shoot this issue with a javascript pulldata function that occurred after our android devices were updated to run version 3.18.145 of survey 123. Everything still works fine on devices running earlier versions (e.g.; 3.17). I used the posts here prepopulate-answers-in-a-repeat-with-last-values to help with my initial trouble shooting, but I am still not getting it to work with the updated devices.
the pulldata script is used to prepopulate a survey answer with a previous value, in our case the initials of the observer, to be repeated for multiple records. The survey does use nested repeats, the observer field is in outer repeat.
js =
function previousvalue (repeat, position, fieldname)
{if (position > 1) {return repeat[position-2][fieldname];
}}
and the calculation is once(pulldata("@javascript", "functions.js", "previousvalue", ${s123_sn_habitat}, number(position(${s123_sn_habitat})), "observers"))
where s123_sn_habitat is the name of the repeat and "observers" is the field name.
I have attached the xls form.
Hi @AndreaPecharich ,
Could you also share the JS function? It may be easier to e-mail it (jtedrick AT esri.com)
Sorry for the delay. I emailed the function