Deleting particular Case in Entry App

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Yass
Posts: 103
Joined: November 11th, 2017, 1:26 am

Deleting particular Case in Entry App

Post by Yass »

Dear Cspro Team,

I find some data with a date reference i would like to delete at the Interviewer level tablet after updating their program, in this way i wrote this function but it seems it not deleting cases created on or before 26th June 2020. The intend again is to delete cases created on or a particular date on Interviewers Tablet.

Please is my code right ?

Code: Select all

function traindate()

forcase coreMkt_dict where dateOfInterview <= 26062020  & reg=13  do

		delcase(coreMkt_dict );
		
	endfor;
	
 end;
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Deleting particular Case in Entry App

Post by Gregory Martin »

The loop and delete calls seem okay. I would be worried about how you're using the date of interview though. It's generally best to use dates in the format YYYYMMDD if you want to do comparisons. Your code, for example, would not delete a case from 27 May because 27052020 is not <= 26062020.

You will likely want to convert your DDMMYYYY date into a format where you can do the comparison. Something like this:
forcase coreMkt_dict where reg = 13 do

    numeric
day = int(dateOfInterview / 1000000);
   
numeric month = int(dateOfInterview / 10000) % 100;

   
if month < 6 or ( month = 6 and day <= 26 ) then
        delcase
(coreMkt_dict);
   
endif;

endfor;
Yass
Posts: 103
Joined: November 11th, 2017, 1:26 am

Re: Deleting particular Case in Entry App

Post by Yass »

Thanks Greg for the help and additional teaching !!
Post Reply