Hello everyone,
I have a pretty simple requirement but I can't seem to figure out how to achieve this in Flow.
I have a form where a user is requested to input an ID number with or without the leading characters, such as:
XYZ000000333222
333222
XYZ333222
XYZ000333222
I am only interested in the last 6 characters of their input (333222 in this example) as I can modify the string later in SharePoint when I do a DB lookup. Using a regular expression ((.{6})\s*$) this is very simple but I'm not sure how to achieve this using a substring or split or some other expressions within Flow.
Solved! Go to Solution.
Hi @scottgm23 , thank you for your post.
I have simulated your form input by using "Compose Input" below:
sub(length(outputs('Compose_Input')), 6)
substring(outputs('Compose_Input'), int(outputs('Compose_Number_Of_Characters_In_Input')), 6)
Regardless of what the input is, this method will get you the last 6 digits of the ID number.
If you have found my post helpful, please mark thumbs up.
Any other questions, just ask.
Thanks, Alan
Proud to be a Flownaut!
Hi @scottgm23 , thank you for your post.
I have simulated your form input by using "Compose Input" below:
sub(length(outputs('Compose_Input')), 6)
substring(outputs('Compose_Input'), int(outputs('Compose_Number_Of_Characters_In_Input')), 6)
Regardless of what the input is, this method will get you the last 6 digits of the ID number.
If you have found my post helpful, please mark thumbs up.
Any other questions, just ask.
Thanks, Alan
Proud to be a Flownaut!
Many thanks @AlanPs1 , I appreciate you taking the time to help.
After some more trial and error, I figured out that I needed to calculate the index value for the substring and then arrived at the same solution as you(well almost). I didn't specify INT in the last subsubstring value but it worked either way.
That's great @scottgm23 .
int() not always required but Flow tends to output to string unless told otherwise so it's a safer option a lot of the time.
I'm glad you have it working!
Happy Flowing!
Thanks, Alan
Proud to be a Flownaut!
Stumbled upon this post when trying to find a solution for the problem I'm facing which is very similar to this one that @scottgm23 was facing. and thanks @AlanPs1 for the solution.
After some running some tests, I figured out actually there is a way to reduce the steps by merging the last two steps. Using @AlanPs1 's solution above as example, i.e.
substring(outputs('Compose_Input'), int(sub(length(outputs('Compose_Input')), 6)), 6)
Thanks AlanPs1. You have no idea how much this helped, and how much I learned by having a workable technique.
Cheers
User | Count |
---|---|
88 | |
39 | |
23 | |
20 | |
16 |
User | Count |
---|---|
127 | |
49 | |
46 | |
33 | |
25 |