Restricting the flow of the survey

Hello everyone. Is there a way to restrict how the survey flows? For instance if I have 3 section in my survey; waterpointinfo, spotcheck and community and I want the waterpointinfo to be entered first followed by spotcheck then finally the community in that order.
At the same time,I would want to restrict the waterpointinfo such that a waterpoint that is already entered cannot be entered again for the same monitoring period

1 Like

Hi @jaredagia! Yes, you can restrict the flow of the survey. One way is to put the sections in order in the survey.
This survey shows how that works using “do section” in the survey sheet:
imgci.xlsx (178.7 KB)
You can limit preventing something from being re-entered (although you want to make very sure then that it gets completed all in one go) by using assign to calculate a variable that is one on the last screen of the section (you may want to condition on everything being completed correctly), and then skipping the section once the variable is one. Here’s an example of using assign:

@elmps2018, Thanks the part for restricting the survey flow works now.
So in my survey,I have a external csv file (cascade list) called as a linked table in the survey with the waterpoint details,ie waterpointid,waterpointname,country,region, e.t.c. So the information is pulled based on the waterpointid,in this case it is the unique identifier for all the survey instances. So I would want to restrict the survey such that a waterpointid that is already entered cannot be re-entered by any field officer collecting data because the survey starts by recording the waterpoint details then all the other questions are being asked.

Hi @jaredagia!

So you can ensure a particular ID (for you waterpointid) is used once and only once using async_assign. Here’s the documentation generally for async_assign:

And here’s an example from one of my projects where we count the number of mothers entered to make sure individuals enter one and only one mother – this is based on the query in the queries sheet and then async_assign_count defines q2303_1 as the number of mothers and has a constraint that this must be exactly one.
quest2_02_3.xlsx (29.1 KB)
You should be able to do the same thing for waterpointid.

@elmps2018, I have tried doing what you said but it does not work still. can I share with you the xlsx you look at it?

@elmps2018, Here is the external file region.csv (7.1 KB) and the survey survey.xlsx (42.8 KB)

Can you provide your customPromptTypes.js file as well? The issue may be in there. I am not quite sure what the file region.csv is either. Is this the data that you have imported into tables already on your tablet?

@elmps2018,the region.csv contains the pre filled information about the waterpoint. Is is manly used in the waterpoints section to pull the respective waterpoint information.

Okay, thanks, then I think this is not the issue. But what about the customPromptTypes.js file? That may be where the problem is happening.

I am trying to upload it but the system does not allow the file extension

1 Like

@elmps2018,I have saved it as a text file,you can change from your end and look at it. customPromptTypes.txt (8.1 KB)

1 Like

So the template path at least looks right on this – is it not recording anything at all in tables? Or is it hanging up/generating an error? I did notice one possible issue – the wptidNumber should be in the model statement in the survey and is not.

Ok,let me check on that.

1 Like

@elmps2018,it is still not working. I can’t figure out where the problem might be.

Sorry you added to the model but it still has other issues! A few things to check:
-Is the variable you are trying to assign showing up in tables (in the header is it listed as a variable)?
-Can you simply assign it a numeric value to test and does that show up (just assign it to be 3 to test)?
-After you go past that async_assign variable, does it record any data in the tables? Or still blank?

@elmps2018, The variable is showing up in tables and it is recording the information as required as shown in the picture below. I have entered one waterpoint 3 times and it recorded the count. So it is the constraint that is not working here now

Thanks that narrows it down a lot! I am not seeing any constraint in the file you uploaded earlier, is it in a different spot?

@elmps2018,I have added it and pushing the files to my phone waiting to test again. I will let you know asap if it works.

@elmps2018 I think I have seen where the problem is. I wrote a wrong thing in the calculation column for s102_wpt_id_Num variable, that is why there is no value being assigned to it and it is the same one I use to check for the number of entries per waterpoint.

1 Like

@elmps2018, it worked thanks.

1 Like