cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AdamEv31
New Member

Subtring Expression returning only the end of a variable

Hi all, 


Just wondering if anyone can help. I am trying to create an expression that will remove the file extension from the end of a file URL, as an example if the URL field being parsed is: 'https://mytenant.sharepoint.com/sites/sitecol/doclib/filename.ext' I would want to remove '.ext'. 

 

I know I can use the replace expression but the URL's are going to constantly change as these are coming from a SharePoint list therefore I need to write an expression, as an example I have the following:

 

 

 

substring(triggerOutputs()?['body/FileRelativeUrl'], lastIndexOf(triggerOutputs()?['body/FileRelativeUrl'], '.'), sub(length(triggerOutputs()?['body/FileRelativeUrl']), lastIndexOf(triggerOutputs()?['body/FileRelativeUrl'], '.')))

 

 

 

 

However this is returning '.ext' instead of the start of the url as I require, how do I get the start of the URL instead. 

 

Any help is appreciated. 

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User
Super User

I think you want:

substring(triggerOutputs()?['body/FileRelativeUrl'], 0, lastIndexOf(triggerOutputs()?['body/FileRelativeUrl'], '.'))

View solution in original post

1 REPLY 1
Paulie78
Super User
Super User

I think you want:

substring(triggerOutputs()?['body/FileRelativeUrl'], 0, lastIndexOf(triggerOutputs()?['body/FileRelativeUrl'], '.'))

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (3,795)