# How do i build a survey form where a value for a variable is automatically filled based on the condition of the information filled in the previous variables?

Hi everyone…

I have a variable “C12_DGBM_SC” type question select_one with answer choices 0 (No); 1 (yes); 66 (not applicable).
Note: Not applicable in C12_DGBM_SC if B6_PN_SC or Try1.xls (39.5 KB) the current pregnancy is the 1st parity or 2nd parity with abortion.

Can I make a constraint formula if B6_PN_SC is answered 1st parity then automatically C12_DGBM_SC is answered 66?

If you want to prefill a default based on a specific response to a previous question, take a look at this thread. You should be able to adapt it to your particular usecase.

1 Like

Thanks Xiphware it’s work…

The answer is automatically filled in but cannot be locked or it can still be changed. Is there an additional formula if B6_PN_SC answered 1st parity the answer cannot be selected, unless 66 (not applicable) ??

Hi @dy10,

You could simply lock the the auto-filled information by using the TRUE under the read_only field as shown in the image below:

GOOD DAY!