I need to validate a repeat to not have duplicates options selected.
I think the workaround for this is to use a calculate using join('',${selectOnevariable}) and then another calculate to check if string have duplicates, I think using a regex could be done. The thing is that I'm not able to find a good expression to validate this. Obviously you can have consecutive duplicates (ej. 001 001) or non consecutives (ej 001 002 001)
Any ideas?
Regards,
Daniel R.
Solved! Go to Solution.
I was able to apply a constrain to the select-on field using a constrain with the following steps:
1.- Calculate a join of the field: ej join('',${fieldselectone})
2.- Calculate isrepeated field inside the repeat using a regular expression: regex(join('',${fieldselectone}),concat('^[0-9]*(',${fieldselectone},')[0-9]*(',${fieldselectone},')[0-9]*$'))
Just note I'm using numbers [0-9] as the character set because on my case the ${fieldselectone} is a numeric code list, you could replace this wit [A-Z] or [A-Z0-9] for alpha
3.- Apply the isRepeated field as constrain on the ${fieldselectone}. Ej not(boolean-from-string(${isRepeated}))
I hope it works for you.
Regards,
Daniel R.
I was able to apply a constrain to the select-on field using a constrain with the following steps:
1.- Calculate a join of the field: ej join('',${fieldselectone})
2.- Calculate isrepeated field inside the repeat using a regular expression: regex(join('',${fieldselectone}),concat('^[0-9]*(',${fieldselectone},')[0-9]*(',${fieldselectone},')[0-9]*$'))
Just note I'm using numbers [0-9] as the character set because on my case the ${fieldselectone} is a numeric code list, you could replace this wit [A-Z] or [A-Z0-9] for alpha
3.- Apply the isRepeated field as constrain on the ${fieldselectone}. Ej not(boolean-from-string(${isRepeated}))
I hope it works for you.
Regards,
Daniel R.