Blocks: Conditional Display of Selected Questions Within a Block

Discussions about CSEntry
Post Reply
rksraajput
Posts: 11
Joined: May 24th, 2022, 3:29 pm

Blocks: Conditional Display of Selected Questions Within a Block

Post by rksraajput »

Dear CSPro Team,

I have a block that contains around 10 questions. Based on the response selected in a previous question, I would like to display only applicable questions, while the remaining questions in the same block should not be displayed.

Is it possible in CSPro to conditionally control the display of individual questions within a block (not the entire block) using logic?
If yes, could you please advise the recommended approach (e.g. set attributes, or any other method)?

Thank you for your guidance and support.

Best regards,
RKS Raajput
Mariovaisman
Posts: 153
Joined: February 11th, 2013, 8:26 am

Re: Blocks: Conditional Display of Selected Questions Within a Block

Post by Mariovaisman »

Hello Raajput,
I didn't see a choice to hide questions in the block, however you can define those questions that you do not want to enter data to protected mode, then when you enter to the block the app skips those questions, you will see those but in grey. Remember to unprotect those questions in case you need to enter data.

Hope it can work fro you.

Mario
rksraajput
Posts: 11
Joined: May 24th, 2022, 3:29 pm

Re: Blocks: Conditional Display of Selected Questions Within a Block

Post by rksraajput »

Dear Mario,

Thank you for the reply.

Actually, every question in the block is conditionally dependent on the previous question, so the display and data entry of each question are controlled by the response to the preceding questions which are not in the block.

Thank you.
Gregory Martin
Posts: 1948
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Blocks: Conditional Display of Selected Questions Within a Block

Post by Gregory Martin »

Using Mario's idea, you could conditionally protect fields. For example:
PROC MY_BLOCK

onfocus

    numeric
is_young = ( AGE <= 12 );
   
    protect(BLOCK_FIELD1, is_young);
    protect(BLOCK_FIELD2, is_young);
Values in protected fields are still validated, so in the above example, the value set (or validation method) would have to support fields with blank values.
rksraajput
Posts: 11
Joined: May 24th, 2022, 3:29 pm

Re: Blocks: Conditional Display of Selected Questions Within a Block

Post by rksraajput »

Thanks for your reply, Gregory Martin.

At present, I am using the following approach in my implementation. I will also try the method you suggested in order to better understand and compare the behavior of both approaches, especially with respect to protection and validation handling.

Code: Select all

preproc
// to protect

	if BCV001A_M = 1 or special(BCV001A_M) then
		BCV001A_REMARK  = "Correct";
		BCV001A_C = 1;
		setproperty(BCV001A_C , "protected" , "yes");
		setproperty(BCV001A_REMARK , "protected" , "yes");
	else
		setproperty(BCV001A_C , "protected" , "no");
		setproperty(BCV001A_REMARK , "protected" , "no");
	endif;
Thank you
RKS Raajput
Post Reply