In this Power BI tutorial, we will discuss how to fix the Power BI error “The template language function ‘length’ expects its parameter to be an array or a string. The provided value is of type ‘Integer’“.
The template language function ‘length’ expects its parameter to be an array or a string
Recently, I was doing a Power Automate of flow example on how to auto generate column value using Power Automate or Flow in SharePoint.
There I was using an expression like below, which was causing the issue.
length(triggerBody()?['ID'])
Basically, I was trying to get the length of the ID column value.
But it throws an error as,
Unable to process template language expressions in action ‘Initialize_variable’ inputs at line ‘1’ and column ‘10896’: ‘The template language function ‘length’ expects its parameter to be an array or a string. The provided value is of type ‘Integer’. Please see https://aka.ms/logicexpressions#length for usage details.’.
And the error looks like below:
I was using the expression like below:
Here, I was trying to get the length of the ID list column, this is an integer column.
So, we need to convert to string to get the length of the ID column value.
In Power Automate or flow expression, we can covert int to string like below:
length(string(triggerBody()?['ID']))
The expression should look like below:
This is how we can get length in Power Automate or flow.
You may like following Flow articles:
- Save my email attachments to a SharePoint document library Power Automate or Flow
- Microsoft flow Send an email showing wrong time for SharePoint list column
- Microsoft flow change true to yes
- How to get manager email or name in Microsoft Flow (Power Automate)
- Create a Custom Document Template from SharePoint List using Microsoft Flow
This is how we can fix error, ‘The template language function ‘length’ expects its parameter to be an array or a string. The provided value is of type ‘Integer’.
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site EnjoySharePoint.com