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.
- Text
Or:
- 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:
- 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.
- 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.
- 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.
Sources:
Back to the Power Apps Function Reference
Photo by Anton Maksimov juvnsky on Unsplash