Edit Pre-entries (Lookup file)

Discussions about CSEntry
Post Reply
Giga
Posts: 4
Joined: September 30th, 2015, 10:49 am

Edit Pre-entries (Lookup file)

Post by Giga »

Hello everyone,

I am facing some difficulties with editing entries which are created by an external dictionary (information from the last year). How am I able to edit pre-entries, because cspro always changes them back the way they were before in my external file? Is it also possible to see it in the data when an enummerator (we're using android tablets) edited a pre-entry?

It is a roster with business assets (machines) and it should be possible to edit the entries from last year, because there might have occured faults during data entry last year.

PROC F1AM

preproc
if loadcase(PRE_ENTRIES_REGU_BA_MA_DICT, LISTING) = 1 then
numeric i;
do i = 1 while i <= count(PRE_ENTRIES_REGU_BA_MA_DICT.PRE_ENTRIES_REGU_BA_MA_REC)
F1AM (i) = MA_F1AM (i) ; //Machine Name
F1BM (i) = MA_F1BM (i) ; //Acquistion year
F1C1M (i) = MA_F1C1M (i) ; //Quantity last year, which is followed by a question concerning the current quantity
F1DM (i) = MA_F1DM (i); //Ownership status
F1E1M (i) = MA_F1E1M (i) ; // Value of machince last year, which is followed by a question concerning the current value
enddo;
endif;

Thank you very much in advance for your help
Philipp
Last edited by Giga on October 2nd, 2015, 1:35 am, edited 1 time in total.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Edit Pre-entries (Lookup file)

Post by josh »

Your logic to fill in the fields from the lookup file will be called every time the interviewer enters the field F1AM. So if you enter F1AM once, then modify the data and then reenter F1AM your changes are overwritten.

One option would be to only load the data in if the fields on the form are currently blank by checking if the value is "notappl". The only trick is that if you are using system controlled mode and you are checking a field that comes after the current field then you need to use visualvalue(). For example:

Code: Select all

if loadcase(PRE_ENTRIES_REGU_BA_MA_DICT, LISTING) = 1 then
    numeric i; 
    do i = 1 while i <= count(PRE_ENTRIES_REGU_BA_MA_DICT.PRE_ENTRIES_REGU_BA_MA_REC)
        // only fill in if currently blank
        if visualvalue(F1AM (i)) = notappl then
            F1AM (i) = MA_F1AM (i) ; //Machine Name
etc...
Giga
Posts: 4
Joined: September 30th, 2015, 10:49 am

Re: Edit Pre-entries (Lookup file)

Post by Giga »

Thank you very much Josh,

it works perfectly fine for all numeric values, but how can I apply it to "alphanumeric" values, like the machine designation?
I get the error message: "ERROR: Invalid variable type - numeric variable expected near line 9 in F1AM procedure"
And btw, I'm using operator controlled mode.

Best regards
Giga
Posts: 4
Joined: September 30th, 2015, 10:49 am

Re: Edit Pre-entries (Lookup file)

Post by Giga »

I think I figured it out myself.

I'm using now:

if F1AM (i) = strip("") then


Regards
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Edit Pre-entries (Lookup file)

Post by josh »

Yes, notappl is only for numeric items. For alpha items, a blank value will be all spaces so using strip and comparing to "" is the easiest way to check for blanks.
Post Reply