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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / concat integer and '.p...
Power Automate
Answered

concat integer and '.pdf' for condition

(0) ShareShare
ReportReport
Posted on by 232

Hi All,

 

I'm trying to set up a 'rename flow' for pdfs dropped into a folder in Sharepoint.

 

Any given pdf in question will always contain the string '1.pdf' to '72.pdf' in their file name, and I want the flow to detect when the file is dropped in a folder, get the file, and create a new file (with the original files content) in an 'Output' folder with the name 'Page1.pdf' to 'Page72.pdf'.

 

I'd rather not have to create an 'if' condition for 72 different scenarios, so I've instead got an:

  • 'Initialize variable' action, named 'PageNumber' with an integer starting at 0,
  • a 'do until' action set to '72'
  • An increment variable action
  • Then a condition set to 'File Name' contains expression:

 

 

 

concat(variables('PageNumber'),'.pdf')

 

 

 

 

To test the flow, I'm dropping in a file named 'OM302120-001.pdf'.

The resulting file should be named 'Page1.pdf'

 

However, my condition is always returning false, and as such, no file is created.

 

Here is the full flow:

Part 1Part 1Part 2Part 2

 

Any ideas where I'm going wrong?

 

Cheers in advance!

 

Chris

Categories:
I have the same question (0)
  • efialttes Profile Picture
    14,756 on at
    Hi
    Does the 'File name' output -the one you are currently evaluating- contain the extension?
    Hope this helps
  • cfebvre Profile Picture
    232 on at

    @efialttes Hi efialttes, I believe so.

     

    Here is a snippet of the output I'm getting for the "When a file is created or modified" trigger.

    I've even tried not using the extension though, and just typing  '001' into the contains 'field' (Not even using the 'PageNumber' variable. Still not working. I have a suspicion the flow is bugged and I'm trying to recreate it from scratch right now.

     

    Increment003.jpg

     

    Cheers!

  • Verified answer
    efialttes Profile Picture
    14,756 on at

    I've recreated your flow, the only difference I think is the fact I am using a different expression  on my condition:

    string(variables('PageNumber'))

     

    The file I tested it with has number 1, so I would expect one only execution of the Do Until. The flow is working fine for me. See Flow execution...

    Page72Condition_1.png

     

    ...and Flow details:

    Page72Condition_2.png

    If you manage to get the flow working once you rebuild it from scratch, please be aware of Do Unitl default limits, click on "Change Limits" if you need to change them

     

    Hope this helps

     
     
     
  • v-alzhan-msft Profile Picture
    Microsoft Employee on at

    Hi @cfebvre ,

     

    Please take a try with @efialttes 's solution and let me know if your problem could be solved.

     

    Best regards,

    Alice       

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Verified answer
    cfebvre Profile Picture
    232 on at

    @efialttes Hi efialttes, thanks for your help.

     

    I actually ended up using the 'When a file is created or modified (properties only)' trigger, and used the 'Name' column in the document library, rather than the 'File Name' variable from my previous configuration, and this worked a treat.

     

    But I can see your configuration would work as well, and I think I might end up doing it this way.

     

    Thanks again for your help.

  • cfebvre Profile Picture
    232 on at

    @v-alzhan-msft Thanks Alice, @efialttes's solution does indeed solve the issue, and I also came up with an alternate solution using the 'When a file is created or modified (properties only' trigger.

     

    Cheers,

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 598

#2
Valantis Profile Picture

Valantis 477

#3
Vish WR Profile Picture

Vish WR 370

Last 30 days Overall leaderboard