web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Splitt filenames in Sh...
Power Automate
Unanswered

Splitt filenames in SharePoint Library

(0) ShareShare
ReportReport
Posted on by 91

I have a flow that separates the file name after an underscore. The first 7 digits are the part number, after the first underscore comes the color number and after the second underscore comes the format. Using the split function with split(variables('String'),'_')[0] I split the name of the document with split(variables('String'),'_')[1] split(variables('String'),'_')[2] and transfer the value from the "Format" field to the "Status" field of the Sharepoint document library. This works perfectly for filenames that are 1017277_31390_7 15 digits long.

But now I want to transfer a value to the Status field also for file names 1021114_10332 which have only one underscore and are 13 digits long, in this case the status should have the value "99". It would be perfect if the condition can be checked that only documents with the extension .png and .jpg are processed.

Translated with www.DeepL.com/Translator (free version)Trigger.png

Flow Part II.png

Flow Part I.png

Library Pictures.png

Categories:
I have the same question (0)
  • Verified answer
    tom_riha Profile Picture
    10,185 Most Valuable Professional on at

    Hello @TomTT ,

    to run the flow only for .png and .jpg files you can use a trigger condition - check if the file name ends with the .png or .jpg string and run the flow only if true.

    @or(endswith(triggerOutputs()?['body/{FilenameWithExtension}'], '.png'),endswith(triggerOutputs()?['body/{FilenameWithExtension}'], '.jpg'))

    For the file name you can adjust just the 3rd expression. Instead of automatically taking the 3rd part of the split

    split(variables('String'),'_')[2]

    you can combine it with the if(...) expression to check how many parts the string has. If it has 3 pieces, it contains also the 3rd part. If it's less than 3 pieces then there's no 3rd part and use the value 99.

    if(equals(length(split(variables('String'),'_')),3),split(variables('String'),'_')[2],'99')

     

  • TomTT Profile Picture
    91 on at

    Hi @tom_riha 

     

    it works perfectly, thank you very much

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard