The Len function is highly versatile and super useful. It is also a function used in all programming languages that I know since it serves a fundamental purpose. With it, you can get the number of characters of a string or the number of elements in a single-column table.

You can use it for both strings and single-column tables to know the number of elements. Please note that you can have the same result using the “Count” function in the single-column table. 

Usage

It follows a simple pattern.

  1. Text

Or:

  1. Single-Column Table

Example:

Len("Manuel T. Gomes")

will return 15

Limitations

For some reason, I cannot replicate the same example as in the single-column table documentation.

Len( [ "Hello", "to the", "World", "" ] )

I don’t see anywhere that it was deprecated, but Power Automate’s error message doesn’t mention tables.

The error is “Expected Text Value.”

I will research a little bit more and update the article with my findings.

Recommendations:

  1. If you want to count the number of elements in a table, use the “Count” function. The Length function has strange behaviors and errors when it comes to tables.
  2. You can use it with the results of formulas or other functions. I would recommend only using one to be able to debug it further and don’t nest functions. The more complex it is, the worse time you’ll have to debug it in case of issues.
  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 Len functions in a formula, you should review it because something’s not right.
Please note that formulas may have localization-based differences. For example, you should write “Len” with “,” separating each of the arguments, but if your regional settings are set to Portugal you should use “ ;” instead.

Sources:

Len function

Back to the Power Apps Function Reference

Photo by Anton Maksimov juvnsky 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 *