I've got a flow set up to send a bot message to Teams when a file is changed in a shared OneDrive directory. The message includes a link to the folder where the file resides. I want the text of this link to be the path of the directory, but in order for it to be user friendly, I want to only keep the part of the path which is after 'root:' and before the file name.
I want to do something like this:
substring( File Path, indexOf( File Path, 'root:' ) + 5, indexOf( File Path, File Name ) - indexOf( File Path, 'root:' ) + 5 )
To take this:
"/drives/b!KosGUJrQ10-JHf8xWUb2Zvba5vzW4a2Du7qcWPXQ99r1usopxzphRrN1IXAVuIeF/root:/External Shared/10466_SAFB/Exports/SAFB_PP.nwc"
to this:
"/External Shared/10466_SAFB/Exports/"
From what I can tell, Power Fx doesn't like the math operators in my expression. The expression returns no errors without the operators, but without the operators, I can't get the specific mid section of the string I want.
Any work arounds or suggestions?
Thanks! I'm happy there are people out there who know more than me! I got the result I wanted using a combination of add() and sub() within the substring() function and Dynamic input for the path.
Hopefully this will get what you're looking for. Assuming the Path is in a Compose action.
slice(outputs('Compose'), add(indexOf(outputs('Compose'), 'root:'), 5), add(lastIndexOf(outputs('Compose'), '/'), 1))