cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
scottgm23
New Member

[Solved] - Extract last n-characters from Form input

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.

2019-03-27_20-05-27.jpg

 

Regex.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Extract last n-characters from Form input

Hi @scottgm23 , thank you for your post.

I have simulated your form input by using "Compose Input" below:Capture-423.png

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


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: Extract last n-characters from Form input

Hi @scottgm23 , thank you for your post.

I have simulated your form input by using "Compose Input" below:Capture-423.png

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


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


View solution in original post

scottgm23
New Member

Re: Extract last n-characters from Form input

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. 

 

Solution.jpg

Super User
Super User

Re: Extract last n-characters from Form input

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


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (5,763)