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'], '.'))

View solution in original post

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,958)