cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate IV
Advocate IV

concat integer and '.pdf' for condition

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

2 ACCEPTED SOLUTIONS

Accepted Solutions
Dual Super User III
Dual Super User III

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

 
 
 


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

@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.

View solution in original post

6 REPLIES 6
Dual Super User III
Dual Super User III

Hi
Does the 'File name' output -the one you are currently evaluating- contain the extension?
Hope this helps


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



@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!

Dual Super User III
Dual Super User III

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

 
 
 


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Community Support
Community Support

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.

@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.

View solution in original post

@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,

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (2,228)