Which database did you use? Do you use the file based database or postgres?
I would suggest you create an extra field with a lowercase version of the code, and search against this. You then know it will always be in a fixed format. You can set this automatically in a Before Commit microflow.
Mendix is busy improving the documentation on this because it depends on the database you are using. You can already do a sneak preview on the documentation they are working on here: https://github.com/mendix/docs/pull/2477/files