AnsweredAssumed Answered

Default values for form variables?

Question asked by baltner on Jan 14, 2016
Latest reply on Mar 1, 2016 by baltner

Is there a way to set a default value for a form variable?  I am asking because it doesn't appear that the value I'm calculating in the formula is calculated until later when I select an option in a choice control.  Here are the details:


I've defined a form variable called newEmployee with this formula:


if(equals(newEmployeeOption,"New Employee"),1,0)


Where newEmployeeOption is an option button choice control allowing two values: "Existing Employee" (default) and "New Employee." Because the default is "Existing Employee" I'm expecting that the newEmployee variable will be set to 0 when the form loads.  To test this I put it in a calculated field so I could see what it was set to but when I load the form no value is defined (see top panel in the attached figure).  Only when I toggle the choice control does anything appear in the calculated field. So either the variable is not calculated when the form loads, or the calculated field I'm using to display it is not calculated until it changes.


This is important because I think a SQL query that I'm using in the form, which refers to the value of newEmployee, does not work.


default value.png