Regarding Constraint

Hi,
I have a form with few integer fields in which i want to have a value of 1 and value of 100 to be compulsorily answered and also there should not be any duplicates in it as well. I have created the form and it is working fine but it is not following the constraint properly, i dont want the user to go ahead if the above criteria does not meet, i have created calculated field and note field to validate the same the filter for note is following properly but it still goes further even if the constraint is true. i am attaching the sample form, kindly check and let us know what might be wrong in it.ah3DgoESH8AvZnW8MLRSpX.xls (9.5 KB)

Hello,

  1. Your IF structures do not work as you intend, they result in something like “11 or 10” >> true (1). Use one of the two options in the example attached. I would also work with integer values. (why text?) If all works, you can change back to calculate type.
    IF Combinations.xlsx (11.2 KB) 2) You can use a acknowledge type (with required = true) and your constraint instead of the note, to stop going on. As KoBo note type is always read-only,
  2. You might control for duplicates already stepwise on each single variable level, with constraint comparing to the existing values, like q10_2 != q10_1
  3. Side-note: Your label and the constraint msg for nq10_1_100 and nq10_dup seem inconsistent: Q9 != Q10
  4. Required or constraint attribute never makes sense with note type.

Side-note: Why force the user to use 1 and 100, but all the rest is free choice?

Kind regards

1 Like

Hi,
Thanks for the reply. Answering all your points.
1 Your IF structures do not work as you intend, they result in something like “11 or 10” >> true (1). Use one of the two options in the example attached. I would also work with integer values. (why text?) If all works, you can change back to calculate type.
2) You can use a acknowledge type (with required = true) and your constraint instead of the note, to stop going on. As KoBo note type is always read-only,
2. You might control for duplicates already stepwise on each single variable level, with constraint comparing to the existing values, like q10_2 != q10_1,
I have all the integer values in the same page so the constraint will not work if it is in the same page.
3. Side-note: Your label and the constraint msg for nq10_1_100 and nq10_dup seem inconsistent: Q9 != Q10
4. Required or constraint attribute never makes sense with note type.
Constraint do work with note i have worked on it with other examples.

Side-note: Why force the user to use 1 and 100, but all the rest is free choice?
Here 1 means lower and 100 means higher so it is compulsory to do so.

Can you just give me a work around the other way to do it. Hope you got my point.

Hi,
The reason for using text i.e ‘10’ was because it was showing as true and false in the note field when i refer the calculate field.
Q9 should contain a value of 1 as well as 100 - ${cq10_1} - ${cq10_100}
What is the reason for this.

Hello,
Ad 1) so, you might use if(… condition …, true(), false() ).
I think it was showing true/false, because you had a boolean construct in your calculation: if(.).or if( .) … So, the text result was converted internally e.g. as boolean (‘10’ or ‘11’ …).
Ad 2) But it is working now with integer on the same page.
Ad Side-note was: Why not allow the user free choice between 1 and 100. If you only need to rank (without fine tuning by numbers) you might use the rank type.
Kind regards

I got it done with calculate and note with constraint applied to note and working fine. it was just that the if condition i was using was a boolean construct so it was problem. Thanks for the reply.

Hello,
Sorry, I think constraint and required doesn’t have any effect on notes. You may just test the note with 1 > 2 as constraint. (Similar with required) See example:
Note Test 02.xlsx (10.1 KB)
I would really appreciate to get to know, if you have different experience for the note…
Kind regards

Hi
Attaching the file which has worked for me with constraint for note which does not allow to move ahead unless it pass the constraint.
ah3DgoESH8AvZnW8MLRSpX (1).xls (9.5 KB)

Hello,
thanks, I was surprised.
But it is more a trick: You use required here to block with a note. The normal note type is readonly, See xlsform.org: “note = Display a note on the screen, takes NO input.” and “Marking … as required means the user will not be able to move on to the next question or submit the form without entering an answer for that question.”

Take a look again, please:: Your constraint message (see text) will never show up (as constraint doesn’t work with note.). You can test it even by putting something like 1 > 2 as constraint.

I made a (final) version for your example, showing some options and features (see comments also).
Constraints and Acknowledge 02.xlsx (14.9 KB)
Kind regards

2 Likes