cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
scottgm23
Level: Power Up

[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
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
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
Level: Power Up

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

Highlighted
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
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 181 members 3,591 guests
Please welcome our newest community members: