Select to view content in your preferred language

Conditional constraint on a repeat

985
6
Jump to solution
02-07-2024 11:27 AM
BrennenW
Emerging Contributor

Im looking to make a conditional constraint on a repeat based off a previous answer.

This is how its laid out:

More than 1?

Yes or No

If selected yes I want the repeat following to have as many repeats as possible.

If selected no I want there to be only one repeat and not let them proceed with additional repeats. 

Any clue if this is possible?

 

Thank you

 

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

Here is a sample attached.  It stops the user from saving a second repeat and gives them a big red warning on why.

I have no idea why you would make a form like this just let them make 1 or more, why ask?  Seems weird but I guess you have a reason.

It does not use repeat_count as that never works out.

Note the message does not fire until they pick the second question value.  But if you want you can change that by adding a secret hidden field that has a default value and then do your check on that if you want.  I can show this too if you do not get it.

And note you cannot stop them from going to repeat 2 but you can stop them from submitting more than 1 repeat.  Best I have found.  We use this a lot with the Opps too far message and it works.

hope that helps

View solution in original post

0 Kudos
6 Replies
DougBrowning
MVP Esteemed Contributor

The way I do it is use a field count(somefieldinrepeat)  and then put a constraint on that.

For you you can then use a if.  Something like

if(picked no, countfield = 1, 1)  the else is just 1 since if they pick yes then its all good.  

You can play with where to place the field with constraint.  I think count works inside the repeat so if you have it there is should stop them from creating a second repeat right away.

Hope that makes sense.

0 Kudos
BrennenW
Emerging Contributor

I guess im a little confused by what you mean. I attached my form below. I was able to get a constraint on the no answer and counting the number of repeats <1 . However, It wouldn't let me go more than 1 repeat with a yes answer. I deleted that from the form as it wasn't working. 

0 Kudos
abureaux
MVP Frequent Contributor

Short answer is 'no', that isn't possible. As soon as you use the repeat_count column, you need a number. Longer answer is "kinda yes'.

This example will not work when "yes" is selected, as no number is provided, so the repeat disappears:

abureaux_1-1707340367026.png

This example will work how you want since there is always a number, but has an extra step:

abureaux_4-1707340631737.png

 

There would be other ways to do this, but this example uses the repeat_count column specifically.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Here is a sample attached.  It stops the user from saving a second repeat and gives them a big red warning on why.

I have no idea why you would make a form like this just let them make 1 or more, why ask?  Seems weird but I guess you have a reason.

It does not use repeat_count as that never works out.

Note the message does not fire until they pick the second question value.  But if you want you can change that by adding a secret hidden field that has a default value and then do your check on that if you want.  I can show this too if you do not get it.

And note you cannot stop them from going to repeat 2 but you can stop them from submitting more than 1 repeat.  Best I have found.  We use this a lot with the Opps too far message and it works.

hope that helps

0 Kudos
BrennenW
Emerging Contributor

Thanks Doug that worked!

The reason behind is to have a sort of fail safe. We work with a lot of college students or fresh out of college and its to make sure they are not entering data on accident as it could change our end results in a bad way. We typically use paper copies and it has been a headache to read their notes sometimes especially when they go back to school and you cant ask them. Appreciate the help!

DougBrowning
MVP Esteemed Contributor

Here is the other option.  I swear I have got a constraint on a note to work but I guess not.  I usually just leave the count shown and make it read only.

0 Kudos