guarantee that all records exist

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

guarantee that all records exist

Post by AriSilva »

I have a dictionary with several records, none of them are mandatory.
I have some cases in the data file.
When calling one of them and trying to execute the data entry, how to guarantee that all the records will be available and with their proper values?
I´m missing the records in a roster, and even in a record type with a single record, after executing the program, the values seem to disappear.
Best
Ari
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: guarantee that all records exist

Post by josh »

In add mode you don't need to do anything special to get the records to exist. They should be available on the forms to fill in. In modify mode, if the records were not filled during the initial data entry then you may need to use add/insert from the menu to add occurrences. Alternatively you can call the insert() function in your logic to do the same.
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: guarantee that all records exist

Post by AriSilva »

I´m sorry, maybe I did not express my problem very well.
The case already exists in the file, and it has all the records. But when I send it to the entry program via a pff file with StartMode=modify, depending upon some conditions I have to skip to a field, and then, the person roster, for example, that was there, disappears. Furthermore, the household record that had previous values associated with the fields are changed to notappl.
I´ve tried to created a dummy field in the household record and put it in the identification form, protected it and in its preproc I set $ = 1; noinput;
At the end, when saving the case this field is assigned 1, but all the other fields are notappl.
Best
Ari
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: guarantee that all records exist

Post by josh »

If you skip to a field then all the fields in between the field you skip from and the one you skip will become notappl because they have been skipped. If you want to keep the existing values then you need to use advance instead of skip.
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: guarantee that all records exist

Post by AriSilva »

That´s precisely the point. I tried to use the advance, but then, it stops in every field that needs a value saying that the value is out of range.
And I need to go to the end of the questionnaire where I have a field for the interviewer write some remarks about the interview. But if I skip to that remark field all the other fields will be notappl.
And I cannot have the same field in two different forms.
Is there a way or a trick to prevent that blanking from happening?
Best
Ari
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: guarantee that all records exist

Post by josh »

Is the case partially saved? Normally in modify mode the case was already completed so there can be no out of range/blank values when you advance.

If the case is partially saved then can you put the remarks field early in the interview? You can skip over it during the normal course of the interview or even make it protected. Then when adding the remark field you can advance to it and then partially save the case and stop after they fill it in.

Other options are to store the remarks in a note (case note or note in a field) or save it to an external file.
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: guarantee that all records exist

Post by AriSilva »

The problem is a little more complicated than that.
It is a survey that occurs 4 times in the year (a panel survey), and for the next panel we have to show the household contents (some fields plus the person roster).
So, it is not a matter of saving partial.
In any case, following your suggestion, I put another remark field at the beginning of the entry, so I do not need to advance to the end. Maybe moving the remark field to the beginning and doing some skipping back and force would be better, but I´m over my head as far as the deadline is concerned. Thanks for that suggestion.
By the way, when trying some alternatives I discovered something very interesting, and I think it should be documented:
If you use the advance statement to a certain field, it will execute the preprocs and postprocs of the fields in the path, that´s ok (that is what says the documentation, but it also executes the onfocus, which is not said in the doc).
But what it is interesting is that if there is another advance statement in the path, it will take precedence over the first one. That is, the new advance will be observed.

A similar process occurs in a preproc when dealing with skips: if there are several skips in a preproc and a noinput, it does not matter where the noinput is placed in the preproc, the last skip is the one that will be observed. The noinput is just to inform that there will be no action from the user. It might be the very first statement in the preproc (and I was thinking that as soon as it reached the noinput it would skip to the postproc).
Best
Ari
Post Reply