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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,930)