Lock command

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
milisahu
Posts: 8
Joined: August 17th, 2021, 12:42 pm

Lock command

Post by milisahu »

Hi Csrpo Team,

I am facing issue when i am writing lock command in Cspro menu. it's working fine with lock my completed cases but partially saved cases not opening with this command. i am pasting here in below my menu logic it will great help if anyone have solution or any idea. actually i want to modify partially saved cases to complete from partial and don't want to anyone modify completed cases.

function launchENUInterview()

string pffFilename = pathname(application) + "../Enumeration/Enumeration.pff";
setfile(pffFile,pffFilename,create);

filewrite(pffFile,"[Run Information]");
filewrite(pffFile,"Version=CSPro 7.5");
filewrite(pffFile,"AppType=Entry");
filewrite(pffFile,"showincompletcases=show");

filewrite(pffFile,"[DataEntryInit]");
filewrite(pffFile,"ShowInApplicationListing=Hidden");
filewrite(pffFile,"StartMode=Add");
filewrite(pffFile,"lock=modify");


filewrite(pffFile,"[Files]");
filewrite(pffFile,"Application=../Enumeration/Enumeration.ent");
filewrite(pffFile,"InputData=../../ENHLD/Enumeration_17.csdb|CSPRODB");




filewrite(pffFile,"[Parameters]");
filewrite(pffFile,"DISTRICTA=%d", DIST_M);
filewrite(pffFile,"BlockA=%d", Block_M);
filewrite(pffFile,"CLUSTERA=%d", CLUSTER_M);
filewrite(pffFile,"ICA=%d", IC_M);
filewrite(pffFile,"SUPA=%d", SN_M);


close(pffFile);

execpff(filename(pffFile), stop);

end;

Thanks in advance
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: Lock command

Post by sherrell »

You've probably seen this help screen in CSPro:

https://www.csprousers.org/help/CSPro/r ... entry.html

The "StartMode=" and "Lock=" options work in tandem.

For example, you wouldn't want to write

StartMode=Add
Lock=Add

for that means you want them to start in add mode, yet have locked them out of add. In your situation, you have locked them out of modify by stipulating:

Lock=Modify

So you would need to remove that in order to allow your user to complete a partially-completed case. If you're concerned about them modifying already-completed cases, then you may want to consider passing in the parameter of the specific case you want them to work on.
milisahu
Posts: 8
Joined: August 17th, 2021, 12:42 pm

Re: Lock command

Post by milisahu »

Hi,

Thanks sherrall for your response!

my propose is i want to not open(i mean lock) completed case and partial saved cases should open for complete interview for that interview from partially saved to complete. as you mentioned yes, i have seen that from help screen in CSPro but that is not enough for my propose.

I can't write codes for specific cases because above problem i am facing in listing survey and it's big survey and more than 200 enumerators working in this study if i will try to write for specific cases so i have to write daily may be for more than 1000 specific cases(partially saved cases) and it's painful.

so @Josh @Gregory Martin could you please take a look into my matter and it will be great help if any codes we have for this.

Thank you very much in advance!
Regards
Mili
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Lock command

Post by Gregory Martin »

Unless you choose to display the cases that are eligible for opening in the menu program itself, which would allow you full control over what to show, you have limited options by using CSEntry's default Case Listing screen.

Perhaps you can instead add logic to your level preproc to prevent people from modifying completed cases. Something like:
PROC HOUSEHOLD_LEVEL

preproc

    if demode
() = modify and not ispartial() then
        errmsg
("You cannot modify completed cases.");
       
stop(0);
   
endif;
milisahu
Posts: 8
Joined: August 17th, 2021, 12:42 pm

Re: Lock command

Post by milisahu »

Thank you very much Gregory Martin!!

working fine! thanks again.
milisahu
Posts: 8
Joined: August 17th, 2021, 12:42 pm

Re: Lock command

Post by milisahu »

Hi,

in addition to this solved problem now one of the my client want to view completed cases with view only mode(can't edit or modify entered data). is it possible?

sorry for i am asking after solved problem. thanks in advance if anyone can help.

Regards,
Mili
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Lock command

Post by Gregory Martin »

We have discussed adding a review mode, but we have not yet implemented it. A workaround, if you do not enable partial saves, is to allow the case to be opened but to prevent data from being saved. This means that someone can modify the case data, but the modifications will not be saved.

Properly implementing this depends on the structure of your data entry application, but to show an easy example, I will make the assumption that there is final field that is always visited, SURVEY_CONFIRMATION.
PROC SURVEY_CONFIRMATION

   
if sysparm("ReviewMode") = "1" then
        stop
(0);
   
endif;
Then, for review mode, you would put this in your PFF's Parameters section:

Code: Select all

ReviewMode=1
milisahu
Posts: 8
Joined: August 17th, 2021, 12:42 pm

Re: Lock command

Post by milisahu »

thank you very much Gregory Martin!

It's working awesome.

Regards
Mili
Post Reply