Require one answer within group

659
2
Jump to solution
04-07-2020 03:57 PM
Soper_Chuck
New Contributor III

I have two questions (cascading selects) within a repeat group. I've limited the repeat to 5, but I also need to require at least one answer (a city). I believe I need to put an expression in the constraint column, but I can't get it to work.

I've attached a sample XLSForm that I adapted from the Cascading Selects sample. Any help would be appreciated.

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

So do you mean you want at least 1 of the 5 to have a value and you have repeat count of 5?

Outside the repeat add a join() which creates a list of values.  Then add a string-length() > 1 constraint to make sure at least something is in there.

A field with count() then constraint of > 0 would also work.

Hope that helps.

View solution in original post

0 Kudos
2 Replies
DougBrowning
MVP Esteemed Contributor

So do you mean you want at least 1 of the 5 to have a value and you have repeat count of 5?

Outside the repeat add a join() which creates a list of values.  Then add a string-length() > 1 constraint to make sure at least something is in there.

A field with count() then constraint of > 0 would also work.

Hope that helps.

0 Kudos
Soper_Chuck
New Contributor III

Initially, I was putting the constraint on the same line as the "select_one cities" field and that didn't work.

Eventually, I figured out that I had to put the constraint on the line as the calculate (count or join) and it finally worked.

Thanks for your help. I really appreciate it.