Hi,
How can I use an OR condition inside the validation.
Basically, I would like to post a message if the age is less than 1 or greater than 100
a!integerField( label: "Age", labelPosition: "ABOVE", value: ri!employee2.age, saveInto: ri!employee2.age, refreshAfter: "UNFOCUS", validations: if( ri!employee2.age < 1 |or , "You must enter proper age", "" )
Discussion posts and replies are publicly visible
Hi there,
Is this what you are looking for?
a!integerField( label: "Age", labelPosition: "ABOVE", value: ri!employee2.age, saveInto: ri!employee2.age, refreshAfter: "UNFOCUS", validations: if( or( tointeger(index(ri!employee2, "age", null)) < 1, tointeger(index(ri!employee2, "age", null)) > 100 ), "You must enter proper age", "" ) )
Acacio B.
Thank you. This works for me.
I would like to know why you have used "index". Can't we just use like below.
Any comments from your end will be appreciated. Thanks in advance.
validations: if( or( tointeger(ri!employee2.age) < 1,tointeger(ri!employee2.age) > 100 ), "You must enter proper age", "" )
Great that works.
Using index() you can handler the nulls and avoid some errors, I normally use but you can check if it is necessary in your case.
Regards,
Acacio B