Hi all,
I'm building this Flow that needs to rename a created document before it gets moved to a folder. Couldn't find what I'm looking for in here, so posting a new topic for it. I'm trying to get everything after the second '-' character in a string. For example, out of the string 'BugsBunny-Arn-999999-67378-CLMPDVVD-TB-GN.docx', I'm trying to make it to be only '999999-67378-CLMPDVVD-TB-GN.docx', what is the correct expression that will work? Have in mind that'd be a dynamic value, so I'm basically taking the Name of the file first and then need to convert it to have only what is after the second '-' character. Thank you!
Solved! Go to Solution.
Hi @benny_blanco , you cannot easily find second index of a character in a string, so the substring() function is not helpful here. I used a combination of split() and join() to get the exact part of string in this case.
1. Split the original string using the expression "split(variables('mystring'),'-')". This creates an array.
2. Now join the array elements in a a Compose starting the third item in the array using the expression "join(skip(variables('myarray'),2), '-')". This results in the string you want.
Hope this helps!
OK Benny Blanco from the Bronx!!
Expression:
split(outputs('Compose'), '-')[2]
https://www.youtube.com/watch?v=zMA5uCYloDk
Hi @benny_blanco , you cannot easily find second index of a character in a string, so the substring() function is not helpful here. I used a combination of split() and join() to get the exact part of string in this case.
1. Split the original string using the expression "split(variables('mystring'),'-')". This creates an array.
2. Now join the array elements in a a Compose starting the third item in the array using the expression "join(skip(variables('myarray'),2), '-')". This results in the string you want.
Hope this helps!
Wow - I read the question completely wrong. 😄
This is my new version now I have read the question properly:
join(skip(split(outputs('Compose'), '-'),2),'-')
Just tested bibhupanigrahi's suggestion which worked perfectly. Thank you @bibhupanigrahi !
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
User | Count |
---|---|
39 | |
36 | |
34 | |
32 | |
27 |
User | Count |
---|---|
45 | |
36 | |
33 | |
25 | |
22 |