Hello,
I am trying to create a flow that will copy a file from one SharePoint Library to another based on the file name.
The file name will always be similar to this format: XXXX-XXXX-####_R1.pdf. What I would like to copy by is the #### part of the name that could be a range similar to 0001 to 0999.
If someone could point me in the right direction that would be greatly appreciated.
Solved! Go to Solution.
Hi @Amanthaper ,
1) There wont always be a underscore after the ####. It will always have a - before ####.
2) The #### range will always be a four digit number, basically from 0001 to 8000 but the ranges will be broken out as 1000 - 1999, 2000 - 2999.
3) If there is a underscore in the name it will always be _R#
Thank you.
Please see this updated expression based on your response.
Substring(replace(variables('hackname'),' ',''),add(lastIndexOf(replace(variables('hackname'),' ',''),'-'),1),4)
You first mentioned first that the name could be XXXX-XXXX-####_R1 or 1000 - 1999, 2000 - 2999 which are quite different.
The expression above works with any of those patterns. Give it a shot.
Cheers,
Aman
------------------------------------------------------------------------------------------------------
If my post helps you with your problem or answers your question, please mark it Solved or Answered. This helps anyone with similar challenges. If you like my response, please give it a Thumbs Up.
------------------------------------------------------------------------------------------------------
Hi @Kell 3 questions,
1) Is there always an underscore after the #### and a - before it? Is this the only underscore in the file name?
2) Will #### range always be 4 digits. You mentioned 0001 to 0999. Is this right?
3) Are there always 2 letters after the underscore (R1)?
Thanks,
Aman
Hi @Amanthaper ,
1) There wont always be a underscore after the ####. It will always have a - before ####.
2) The #### range will always be a four digit number, basically from 0001 to 8000 but the ranges will be broken out as 1000 - 1999, 2000 - 2999.
3) If there is a underscore in the name it will always be _R#
Thank you.
Using your convention in an example, I used the following function to get the characters you mentioned:
Substring(variables('hackname'),sub(lastIndexOf(variables('hackname'),'_'),4),4)
Replace variables('hackname') with your object reference.
Cheers,
Aman
------------------------------------------------------------------------------------------------------
If my post helps you with your problem or answers your question, please mark it Solved or Answered. This helps anyone with similar challenges. If you like my response, please give it a Thumbs Up.
------------------------------------------------------------------------------------------------------
Please see this updated expression based on your response.
Substring(replace(variables('hackname'),' ',''),add(lastIndexOf(replace(variables('hackname'),' ',''),'-'),1),4)
You first mentioned first that the name could be XXXX-XXXX-####_R1 or 1000 - 1999, 2000 - 2999 which are quite different.
The expression above works with any of those patterns. Give it a shot.
Cheers,
Aman
------------------------------------------------------------------------------------------------------
If my post helps you with your problem or answers your question, please mark it Solved or Answered. This helps anyone with similar challenges. If you like my response, please give it a Thumbs Up.
------------------------------------------------------------------------------------------------------
User | Count |
---|---|
89 | |
37 | |
26 | |
13 | |
12 |
User | Count |
---|---|
128 | |
53 | |
37 | |
26 | |
21 |