Recording data from skipped questions

Hi ODK Forum - Longtime lurker, first time poster.

I'm trying to design an xForm that records if a user has swiped to and then back from a question. For example, a user sees "question2", she swipes back, and then heads down a different skip logic pathway. Is there anyway that I can see that a user swiped to "question2"?

As background context, I'm creating a health application that is trying to identify knowledge gaps in our treatment protocols. I'd like to give several options for treatment, and if a user selects the wrong answer based off of patient symptoms, she needs to swipe back to select the correct answer. However, I want to see data that she initially selected the incorrect answer.

1 Like

@LN will the new timing feature be a sneaky way for Nick to get the data he wants?

Nick: there is a new timing feature in Collect that records when the user arrives at and departs at various questions. I am not sure what its precise scope is, but I suspect it may help answer your question. You won't be able to know what the incorrect initial answer was, but as you indicated you can at least capture the hint that an action of that pattern occurred.

1 Like

Hi,

I am not sure of exact answer to Nick's query, but some time ago I faced a situation which seems related. I had a jump logic at Q2, and the answer to Q3 (behind option 1) and Q4 (behind option 2) were compulsory. When I took the route of selecting and option and moving forward (the normal was as Nick said), it was all OK. But when I moved back from Q3 or Q4 and took the other path, the form used to tell me that I am missing the compulsory answer to the other question (the one from where I tracked back), and it failed to move ahead unless I provide the answer.

I am not sure if this is relevant here, but you might put in some conditions which are triggered if the page is opened (like the timing feature mentioned by Client above).

Regards,
Saad

1 Like

Hi Nick,

When I've had a similar need in the past, I've created a calculation that uses the once() function to capture whatever is entered first. If that value is later changed, the calculation with the once() function will continue to preserve the initial entry. Note that this only works to preserve the first entry, not any interim entries between the first and and final entries.

Hopefully that helps.

Jason

2 Likes

Hi Jason,

Can you kindly share the example XML code?

Thanks,
Saad

Thanks everyone for the help! Jason and Saad, I tried using the once function, but couldn't get it to work. I attached a quick test which uses once(1) to try and capture when question2 is answered (but then swiped back to skip over it). I've attached my XML code. Would love to hear what you guys think,

onceTest.xml (2.0 KB)

Attached is a basic example.

So Nick, I think what you'd want to do with your example is just make the calc for keylog "once(/data/question1)". Then you would see what they initially entered for question 1. It will usually have the same value as question 1, but occasionally could have a different value if they changed it.

I would also drop the relevancy on there, once() is basically it's own relevancy, it records the value as soon as the item in the once() function is not null. If you keep the relevancy that calc (and the captured value) is going to get dropped if question2 becomes something other than 1.

If you have other conditions you need to put on a once() capture, you should be able to put an if() around it using this format:

once(if(/data/question0 = 7, /data/question1, null))

That will keep it null (and unlocked) until question0 = 7 and question1 has a response, then it will lock in the question1 value.

Jason

once.xml (2.4 KB)

2 Likes

Yup! That worked for me. I've attached an .XML file with the once() Test working. Like you said, the trick was to have the ONCE function calculate the questionID. This is a huge help. Thanks Jason and all!

OnceTest.xml (2.1 KB)

1 Like