Logging operator ID with cases entered

Discussions about CSEntry
micl
Posts: 5
Joined: April 30th, 2017, 9:17 am

Logging operator ID with cases entered

Post 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
Saint
Posts: 63
Joined: November 22nd, 2013, 4:59 am

Re: Logging operator ID with cases entered

Post 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?
Gregory Martin
Posts: 1796
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Logging operator ID with cases entered

Post 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);
micl
Posts: 5
Joined: April 30th, 2017, 9:17 am

Re: Logging operator ID with cases entered

Post 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.
micl
Posts: 5
Joined: April 30th, 2017, 9:17 am

Re: Logging operator ID with cases entered

Post 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!
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Logging operator ID with cases entered

Post 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.
micl
Posts: 5
Joined: April 30th, 2017, 9:17 am

Re: Logging operator ID with cases entered

Post by micl »

Hi Josh, I just double checked and it's in the dictionary as Alphanumeric.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Logging operator ID with cases entered

Post 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?
micl
Posts: 5
Joined: April 30th, 2017, 9:17 am

Re: Logging operator ID with cases entered

Post 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.)
Saint
Posts: 63
Joined: November 22nd, 2013, 4:59 am

Re: Logging operator ID with cases entered

Post by Saint »

I think its because you have the PREPROC on the PROC QUEST instead of having it on the OPERATOR_ID variable PROC.
Post Reply