cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Magikmissy
Level: Powered On

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
Level: Powered On

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
Microsoft Krishna92
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.
 
Magikmissy
Level: Powered On

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

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (4,913)