cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Magikmissy
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
Magikmissy
Helper II
Helper II

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
Krishna92
Microsoft
Microsoft

@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.
 
Magikmissy
Helper II
Helper II

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
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (46,437)