cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Problem with expression

Hi everyone, 

@edgonzales very kindly gave me the below as a solution to some problems I was having with my flow. Unfortunately it won't let me enter it! I'm getting an error saying 'The expression is invalid.' from the expressions tab. I'm sure it'll just be a typo like a comma or bracket in the wrong place, but I don't know enough to correct it. Can anyone help please, as Ed won't be up for 5 hours yet...! 😂

substring(items('Apply_to_each')?['name'],0,add(indexof(items('Apply_to_each')?'name'],last(split(items('Apply_to_each')?['name'],'.'))),-1))

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper II
Helper II

Re: Problem with expression

It was missing a bracket!

 

Substring(items('Apply_to_each')?['name'],0,add(indexof(items('Apply_to_each')?['name'],last(split(items('Apply_to_each')?['name'],'.')) ),-1))

View solution in original post

2 REPLIES 2
Highlighted
Microsoft
Microsoft

Re: Problem with expression

@Magikmissy 

 

I think the problem is with the indexof() function it accepts only two parameters and in the below formula you are trying to pass three parameters, indexof(items('Apply_to_each')?'name'],last(split(items('Apply_to_each')?['name'],'.')

 

indexOf
This function finds the index of a value within a given string case insensitively. This function requires 2 parameters: the string that contains the value and the value to search the index of.
Function: indexOf(text, searchText)
 
If this information helps you, please hit the like button and mark the solution as resolved, so that it will help other users in future.
 
Highlighted
Helper II
Helper II

Re: Problem with expression

It was missing a bracket!

 

Substring(items('Apply_to_each')?['name'],0,add(indexof(items('Apply_to_each')?['name'],last(split(items('Apply_to_each')?['name'],'.')) ),-1))

View solution in original post

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,349)