Multiply occurrence doesn't save & Nested skip if

Discussions about CSEntry
Post Reply
lukman.manggo
Posts: 13
Joined: October 14th, 2016, 3:22 am

Multiply occurrence doesn't save & Nested skip if

Post by lukman.manggo »

Hi All

I have Q2, Q7 and Q8 (Q8A, Q8B, Q8C, Q8D)


Q8: depend what answered on Q2 alpha:
Q8A answered 1 on Q2
Q8B Answered 4 or 5 or 8 on Q2
Q8C Answered 3 or 6 on Q2
Q8D Answered 2 or 9 on Q2

I tried the logic with nested if statement but failed. I loss. Confused ... so I created dummy variable as the control logic for Q8. Please see the Q8Control on zip attached. I have tested this program. They are working fine but for Q7.
For Q8: if any other way to use the skip logic directly on Q8 that more simple please ?

On Q7:
Variable Q7 string is converted to Multiply occurrence variable Q7YN()
During data entry process Q7YN() seems ok on converting to 1 and 0, but failed to save its value. So no value at all created when I exporting the data in any format. If I tried to modify the case, its blank.
Please help ? See the logic and mtdec2016.zip . Million thanks

Lukman

Code: Select all

This is the logic:

PROC GLOBAL

PROC MTDEC2016_FF

PROC Q7


numeric i;
string alphabet1 = "12345";

do i = 1 while i <= 5
	string letter = alphabet1[i:1];
	
	if pos(letter, Q7) <> 0 then
		Q7YN(i) = 1; 
	else
		Q7YN(i) = 0; 
	endif;	
enddo;
if length(strip(Q7)) = 0 then
endlevel;
endif;



 if pos("2",Q7) <> 0 then
 skip to Q8ACONTROL;
 else
 skip to Q9;
 endif;
  

PROC Q8ACONTROL

preproc
if pos("1", Q2) then 
 skip to Q8A;
else
 skip to Q8BCONTROL;
endif;

PROC Q8BCONTROL

preproc
if pos("4", Q2) or pos("5", Q2) or pos("8", Q2) then 
 skip to Q8B;
else
 skip to Q8CCONTROL;
endif;
PROC Q8CCONTROL

preproc
if pos("3", Q2) or pos("6", Q2) then 
 skip to Q8C;
else
 skip to Q8DCONTROL;
endif;
PROC Q8DCONTROL

preproc
if pos("2", Q2) or pos("9", Q2) then 
 skip to Q8D;
else
 skip to Q9;
endif;
PROC Q9

PROC ALL_DONE  { pause, inform that the interview is over }
    EndLevel;    { saves current case }
//    Stop(0);     { stops add/mod/ver mode }


{ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= }


Attachments
mtdec2016.zip
(4.58 KiB) Downloaded 264 times
lukman.manggo
Posts: 13
Joined: October 14th, 2016, 3:22 am

Re: Multiply occurrence doesn't save & Nested skip if

Post by lukman.manggo »

Dear All

I have found the problem and solved itu.
On Q7, I only remove the statement "Endlevel" and put EndIf in the end of logic. See the Q7 logic.
So now Q7YN() occurrence that created value 1 and 0 can save normally.

I am still waiting for your help to give me the other option of "if nesting logic" for Q2 to Q8, instead my logic that use control field.

Thanks.

Lukman

Code: Select all

PROC Q7

numeric i;
string alphabet1 = "12345";

do i = 1 while i <= 5
	string letter = alphabet1[i:1];
	
	if pos(letter, Q7) <> 0 then
		Q7YN(i) = 1; 
	else
		Q7YN(i) = 0; 
	endif;	
enddo;
if length(strip(Q7)) = 0 then
//endlevel; 
//endif;


 if pos("2",Q7) <> 0 then
 skip to Q8ACONTROL;
 else
 skip to Q9;
 endif;
 endif;  // put here 
Post Reply