November 20, 2024

The toUpper Function sets all items in a string to uppercase. There is the toLower function also, and these functions are super useful, mainly if you collect information from a form from example. People tend to write differently, and having a function that magically transforms everything at once can make a world of difference.

Usage

It follows a simple pattern.

  1. String

Example:

String
'Manuel T. Gomes'

toUpper(variables('String'))

will return 

'MANUEL T. GOMES'

Quite straightforward, right?

Limitations

It will take only uppercase characters that have an uppercase variant. For example, if you pass it “こんにちは” (Hello in Japanese ) it will return the same thing with no error. The same if the string is already in uppercase.

Recommendations:

  1. When comparing strings, always use toUpper to compare them accurately. If you compare “Manuel T. Gomes ” and “MANUEL T. GOMES,” the result will be false, although you may want the result to be the same. For example:
equals('Manuel','MANUEL')

will return false

equals(toUpper('Manuel'),toUpper('MANUEL'))

will return true
  1. Use it even if you don’t expect uppercase characters. For example, if you have a site only receiving information from Thai users, the names will, usually, don’t have an upper or lower case, but including the toUpper can avoid issues in the future if something changes.
  2. In some instances, it’s useful to store one variant of this information. For example, when storing emails, always use an option of the upper or lower case. It will keep the data consistent and more comfortable to compare.
  3. Don’t nest it. There’s no real reason to do it, but if you find yourself in a situation where you have nested toUpper functions in a formula, you should review it and make everything more straightforward.

Sources:

Microsoft’s toUpper Function Reference

Back to the Power Automate Function Reference.

Photo by Justin Lynch on Unsplash

Manuel Gomes

I have 18 years of experience in automation, project management, and development. In addition to that, I have been writing for this website for over 3 years now, providing readers with valuable insights and information. I hope my expertise allows me to create compelling, informative content that resonates with the audience.

View all posts by Manuel Gomes →

Leave a Reply

Your email address will not be published. Required fields are marked *

Mastodon