validations: if( a!forEach( items: ri!grid, expression: count( fv!item['test}iscorrect'] ) > 1 ), "Only one fav can be selected", null ),
Hello All,
I have an editable grid with multiple rows.
I have fav button on each row. I need to validate only one fav is allowed per user. How can I achieve this pls.
Here validation is not working. All my grid data is coming from ri and saving back to ri.
Discussion posts and replies are publicly visible
If this field is a boolean, you can just use the sum() function as true equals 1 and false equals 0. As there might be some null values, use something like the following code snippet.
a!localVariables( local!values: {1,0,null}, sum(local!values = true) )
Apply this to the field in your items where you store the favourite value. Then, disable your button, in case the sum is > 1.
Thank you Stefen. But my requirement is to validate in editable gridlayout in validation section. My code snippet pasted.
OK, and that is exactly what my example is about. Just adapt it to your data.