LOOP OVER WRITTING

Discussions about CSEntry
Post Reply
segxy4manu
Posts: 37
Joined: August 31st, 2016, 5:51 pm

LOOP OVER WRITTING

Post by segxy4manu »

Good day ,
Please i need your urgent help on this.

I write an application that interview Adults and Adolescent
after the HH roster..
You can proceed to interview the Adults.
The Adults Questionnaire is made a loop but the problem is once it picked the first adult and fill all responses.
then selecting the next adult it will over write all the first adult records and looking at the data file in csdb you will see that only the last adult interview will have the records on the table.

I dont mind sharing the entire program with you to see.

Thanks
justinlakier
Posts: 152
Joined: November 21st, 2022, 4:41 pm

Re: LOOP OVER WRITTING

Post by justinlakier »

Good day,

Multiply occurring records should automatically make tables, so it may be that you are overwriting something if you are using a loop in code to set values rather than the record entry. It would help if you could share your program so that we can see where the problem is.

Thank you,
Justin
segxy4manu
Posts: 37
Joined: August 31st, 2016, 5:51 pm

Re: LOOP OVER WRITTING

Post by segxy4manu »

The problem is when the Adult questionnaire is being answered
let say we listed 2 adults in the roster and we move to interview the first adult...
by the time we interview the second adult. the details will be collected as normal but from the data viewer of the csdb it shows that it's over write the first data and we have one record instead of 2 records
Attachments
AIS BCK.zip
(209.34 KiB) Downloaded 211 times
justinlakier
Posts: 152
Joined: November 21st, 2022, 4:41 pm

Re: LOOP OVER WRITTING

Post by justinlakier »

This is not an issue of loop over writing. If you partial save the case after entering multiple adults and then check the partial data in the csdb, you will see multiple adults recorded. However if you then save the case, it will only show one. This is because a complete save only records data on the path, while the partial save also records data that is off the path. Your use of the Move statement skips over interim fields, which means their contents are not on the path. In order for a field to be saved the path has to flow through it as the case is being finalized, which Move does not do. Skipping backwards and attempting to write out another case is putting only the most recent on the path, which functionally erases other adults. You are also using Insert, which is intended for use in batch editing applications and may be causing additional problems in entry. I would recommend changing the way you're letting the user choose who they want to interview and creating the record at that time; instead you should force the flow for the adult & adolescent rosters based on who was eligible. If the person isn't available to interview at that time, then skip over them, rather than revisiting an earlier form as the control. Forcing the structure to flow in one direction like this should remove the need for Insert or skipping backwards with Move. Please let us know if you have any additional questions.

Hope that helps,
Justin
Post Reply