Here is a quick tip for anyone struggling with InfoPath. It’s not the smoothest peach in the bowl, but it gets the job done.
When configuring an InfoPath form tied to a SharePoint list, you lose the ability to use custom code. This gets old really quick. I was struggling with fields not matching because of case sensitivity. Here is an example:
NameField = NameFromDatabase
NameField might be Viktor, viktor or VIKTOR. NameFromDatabase could also vary. What I did here was apply a translate function to each value I was comparing.
translate(X, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")
This replaces all the uppercase with lowecase letters. In my case it would read:
translate(NameField, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" , "abcdefghijklmnopqrstuvwxyz") = translate(NameFromDatabase , "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")
It’s not pretty, but it works. Similarly, I used translate to fix phone numbers and postal codes which might have spaces in them with this snip
translate(X, " –.", "")
As you might have guessed, it replaces all the special characters (space, – and . ) with a blank value. In this way “08-40 12 13” and “08401213” matches each other.
