Page 1 of 2

Batch to catch spesific Case ID

Posted: April 11th, 2017, 5:18 am
by langitluna
Greeting All

Anyone can give me example of batch to catch only particular case base on case ID (as unique one) ?
My case id field name : Case_ID. I want to catch some cases for only some specific cases.
Ex Case_id 10,13,12,100 on output.dat

Your help very appreciate.

Thank you

Re: Batch to catch spesific Case ID

Posted: April 11th, 2017, 10:48 am
by josh
What do you mean by "catch"? Do you want to print out those cases? save them to the output file?

Re: Batch to catch spesific Case ID

Posted: April 11th, 2017, 11:41 am
by langitluna
Hi Josh
i mean I want to get the output of entry result with particular case Id, all fields within dictionary.
So if I have 100 cases on output.txt with case _I'd 1 - 100.:
What if I want only cases with case_id: ex 1 , 3, 10,50,97. The output on entry mode only that case.
Thanks Josh

Re: Batch to catch spesific Case ID

Posted: April 11th, 2017, 2:01 pm
by josh
You can use the skip case command to skip the cases that you don't want:

Code: Select all

if not case_id in 1, 3, 10, 50, 97 then
   skip case;
endif;

Re: Batch to catch spesific Case ID

Posted: April 11th, 2017, 10:45 pm
by langitluna
Brother Josh
Thx you very much. Can this such logic I add in batch to:
- delete the case
- Separate the case by other fields like demographic field ex city, age etc
So the logic would be like : if city in 1, 2 then skip case
Thx and very appreciate

Re: Batch to catch spesific Case ID

Posted: April 12th, 2017, 12:40 am
by langitluna
Brother Josh

>>You can use the skip case command to skip the cases that you don't want:
=============
if not case_id in 1, 3, 10, 50, 97 then skip case;
endif;
==============

Yes this logic perfectly well.

What if I want only case_id 1, 3, 10, 50, 97 ?

Thx

Re: Batch to catch spesific Case ID

Posted: April 12th, 2017, 10:42 am
by josh
Remove the "not"

Re: Batch to catch spesific Case ID

Posted: April 12th, 2017, 12:29 pm
by langitluna
Brother Josh

I have tried, but its not work.
I have attached the zip file. Would you please see it.

//In DATA_ALL.DAT has 10 cases with ID (RESP_ID): 1,2,3,10,22,99,97,56,21,50
//I want only this ID : 1, 3, 10, 50, 97 DATA_OUTPUT.dat

Re: Batch to catch spesific Case ID

Posted: April 12th, 2017, 1:39 pm
by Gregory Martin
You put that code in the application-level PROC, which gets run only one for your whole run. You need to put the code in a PROC that gets run for every case. See below:
PROC ABC_QUEST

preproc

    if not RESP_ID in 1, 3, 10, 50, 97 then
        skip case;
    endif;

Re: Batch to catch spesific Case ID

Posted: April 13th, 2017, 2:51 am
by langitluna
Ahaa. Now it is worked. Thx my brother.
One question about this: in batch :
if I have a skewed data, I mean the data is unclean yet, ex bad record because off wrongly key in ; will effect to the output batch? thanx Gregory , .