Page 1 of 2

Logging operator ID with cases entered

Posted: April 30th, 2017, 9:29 am
by micl
Hi all,

I would like to a create a variable or log file in which the operator ID would be saved with each case ID entered. This would help with quality control and auditing activities.

I know a workaround is to create a field on the first form in which the operator would manually enter their ID after (or before) the case ID, but I would like to automate the process so the operator doesn't have to enter their ID for every case.

I have been trying to play around with the following syntax that I found on another forum post. I assume that the GETOPERATORID function has a role to play.

Code: Select all

file auditFile;

function On_Focus()

    filewrite(auditFile,"%s,%s,%08d,%06d",getoperatorid(),getsymbol(),sysdate("YYYYMMDD"),systime());

end;
I appreciate any guidance on modifying this code or creating a new code!

Thanks so much,
Mike

Re: Logging operator ID with cases entered

Posted: April 30th, 2017, 10:36 am
by Saint
Hi Mike,
Are you doing entry in the office or its a CAPI program? How are the files structured: will different operators be entering into the same file or strictly one file per enumerator. If its one file per enumerator (per cluster), then its safer to go with the operator ID as a variable and make it a persistent field so the operators enter it just once. Does the code you posted give any error message?

Re: Logging operator ID with cases entered

Posted: April 30th, 2017, 10:52 am
by Gregory Martin
The getoperatorid function returns the operator ID text that was entered when the keyer/interviewer opened CSEntry. At the beginning of the case, you can fill in your variable:
PROC QUEST

preproc

    OPERATOR_ID = getoperatorid();
If you don't want that variable overwritten if program is opened by someone other than the original person, you can write:
PROC QUEST

preproc

    if OPERATOR_ID = "" then
        OPERATOR_ID = getoperatorid();
    endif;
If you would rather the operator ID be entered as a field on the form, you can store the setting from session to session. Something like this:
PROC OPERATOR_ID

preproc

    // prefill the operator ID
    OPERATOR_ID = loadsetting("OPERATOR_ID");

    // if you want to prompt the keyer each time, comment out these lines
    if OPERATOR_ID <> "" then
        noinput;
    endif;

postproc

    // save the operator ID
    savesetting("OPERATOR_ID",OPERATOR_ID);

Re: Logging operator ID with cases entered

Posted: April 30th, 2017, 11:35 am
by micl
Thank you so much for your help. These code snippets should solve the problem. There will only be one keyer per case (entered at the office, not CAPI) but multiple keyers entering cases in the same file using the Data Entry program. It will be good to ensure that the Operator ID isn't overwritten if a supervisor opens or modifies the case afterward. I'll have access to the file tomorrow, but I'm guessing option 2 or 3 should do the trick.

Re: Logging operator ID with cases entered

Posted: May 1st, 2017, 2:11 pm
by micl
I am trying to use the second code example in order to not overwrite the operator ID, but I keep getting an invalid statement error ("ERROR: Invalid statement near line 5 in QUEST procedure") on the following line:

Code: Select all

if OPERATOR_ID = "" then
Anyone have an idea about what's going on? The first code example works fine. Thank you!

Re: Logging operator ID with cases entered

Posted: May 1st, 2017, 3:14 pm
by josh
Is OPERATOR_ID in your dictionary alphanumeric or numeric? You might that get error when comparing a numeric variable to string like "". You probably want OPERATOR_ID to be alphanumeric.

Re: Logging operator ID with cases entered

Posted: May 1st, 2017, 3:19 pm
by micl
Hi Josh, I just double checked and it's in the dictionary as Alphanumeric.

Re: Logging operator ID with cases entered

Posted: May 2nd, 2017, 8:35 am
by josh
I don't see anything wrong with line. Maybe an error in a line nearby is getting reported in the wrong place. Can you post your app so we can see the whole thing?

Re: Logging operator ID with cases entered

Posted: May 3rd, 2017, 4:04 pm
by micl

Code: Select all

{Application 'ENTRY' logic file generated by CSPro}
PROC GLOBAL

PROC FF

PROC QUEST
preproc

if OPERATOR_ID = "" then
   OPERATOR_ID = getoperatorid();
endif;

The error that pops up on line "if OPERATOR_ID = "" then" is:
ERROR: Invalid arithmetic or conditional expression near line 3 in QUEST procedure
Thanks again for your help. I'm not sure what's going on. (Again, the first code example works perfectly.)

Re: Logging operator ID with cases entered

Posted: May 3rd, 2017, 8:51 pm
by Saint
I think its because you have the PREPROC on the PROC QUEST instead of having it on the OPERATOR_ID variable PROC.