How to make a case insensitive comparison in an app form?

For an app form text field’s constraint, I want to do a case-insensitive comparison of two strings. I’m attempting to use lower-case(.) = lower-case(${variable}) and I’m seeing this error:

Could not evaluate: lower-case(.)=lower-case( /model/instance[1]/group_name/variable ), message: callNative() can't handle nodeset functions yet for lower-case()

We can do this with the ODK’s translate function.

translate(string, fromchars, tochars)

Returns a copy of string , where every occurrence of a character in fromchars is replaced by the corresponding character in tochars .

Using this function, we can convert both texts to lowercase, and compare them.

translate(${input}, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')

2 Likes