I need to have a rooster triggered by either a numeric or a multi select question, but then follow a sequence from 1,2,3,…
I have this output, where I need to select the 8 structures, but they should be sequential from 1 to 8.
You could create a list question (list_q) as a source of your roster and ask them to list sequential numbers.
To validate that those are indeed sequential you could create a macro named $validate_seq with expression
var numbers_entered= list_q.Select(x=>Int32.Parse(System.Text.RegularExpressions.
Regex.Match(x.Item2, @"^\d+").Value)).Distinct().ToArray() ;
Array.Sort(numbers_entered) ; /*Include this line if you only care if all numbers entered are sequential*/
for (int i = 1; i < numbers_entered.Length; i++)
if (Convert.ToInt32(numbers_entered[i]) !=
Convert.ToInt32(numbers_entered[i - 1]) + 1)
return false;
return true;
At the list question itself, add a validation condition with expression
(new Func<bool>( () => {$validate_seq;})).Invoke()
It doesn’t work for negative values. But before validating this, you should probably validate that they only enter digits etc.
Still, I think you make your life more complicated than it needs to be, see here.