I have a select_one question with 5 potential responses. I have a corresponding integer question that is filled in based upon the results from the select_one. I have a calculation on the integer question that either returns a 0 or nothing depending on the select_one. If the calculation is 0, worker moves on, if the field is blank from the calculation, then the worker is required to add a value greater than 0. Can i add a constraint to the integer field only when the calculation returns 'blank'?
Thanks,
--gary
Found the examples of the form expressions for required fields and that works great.
Thanks,
--gary
Jumped the gun a little. i got the field to be required using the form expressions but not the constraint yet. Still looking at this and in need of some assistance.
thanks,
--gary
I have the following formula in the constraint field:
if (selected(${mia_9x5}='NRM',.>0,''))
This is enforcing all values to be greater than zero, even when the the selected value is not 'NRM'.
Help.
Thanks,
--gary
Hi Gary,
Can you share the select_one and subsequent calculation? The calculation you supplied above appears to have misplaced parenthesis; the if parameters appear to be in the selected() question. This should be:
if(selected(${mia_9x5), .>0, '')
If this is used in a constraint, there is an issue with the if_false value - constraints expect either true or false value. If you want a 'pass' if mia_9x5 has no selection, have the value true() in place of '' to allow any value:
if(selected(${mia_9x5), .>0, true())
If you want it empty, I would instead make the question non-relevant or read-only to prevent input.
James,
Thanks for the assistance. The following calculation in the constraint field works as required:
if(selected(${mia_9x5})='NRM',.>0,true())
When 'NRM' is selected the integer value entered must be greater than zero, if any of the four other choices in the select_one are chosen, the default value of 0 passes.
Thanks again,
--gary
James,
I did some further testing and the constrain does not work properly. If NRM is selected any value passes through the constraint (negative numbers, 0 positive numbers).
What do you need to see?
Thanks,
--gary
Hi Gary,
Dumb syntax error based in the selected function - it takes the argument you want to check for equality with in the function:
selected(${mia_9x5},'NRM')
not
selected(${mia_9x5})='NRM'