cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JPey
Regular Visitor

Formatting MS Forms response to be used later in the flow

Hello everyone,

 

Somewhat new to Power Automate, but really appreciate the potential I am seeing. 

 

Background:

I have a long text question I am asking in an MS form: 

"Enter 10-digit phone number, if you have multiple numbers please separate them with a comma

ex1: 5555555555   |    ex2: 5555555555,1111111111,2222222222"

 

The problem is most people are coping numbers from an excel spreadsheet and pasting them in the form answer box causing the answer to look like this:

1111111111

2222222222

3333333333

4444444444

 

In order to use the numbers in the next part of the flow, I need them in the format of:

1111111111,2222222222,3333333333,4444444444

 

Question:

Is there a method in power automate to check if there is a comma every 10 digits, and if not add one?

Is there a better way to solve my problem, than the question above? 

 

Any guidance you can provide is greatly appreciated. Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @JPey ,

 

Sorry i didn't reproduce this problem, it seems that works fine on my side.

vyujincuimsft_0-1656296495976.png

Result Screenshot:

vyujincuimsft_1-1656296560446.png

vyujincuimsft_2-1656296613766.png

vyujincuimsft_3-1656296634905.png

Maybe you could consider checking the run history and expressions(Note the name of the dynamic content in the expression).

replace(replace(replace(outputs('Compose'),' ',''),',',''),decodeUriComponent('%0A'),'')
range(1,div(length(outputs('Compose_2')),10))
substring(outputs('Compose_2'), add(mul(item(), 10), -10), 10)
substring(variables('phonenumber'),0,add(length(variables('phonenumber')),-1))

vyujincuimsft_4-1656297002258.png

vyujincuimsft_5-1656297122378.png

 

 

Best Regards,
Charlie Choi

View solution in original post

7 REPLIES 7
JPey
Regular Visitor

Any ideas? Maybe it is not possible, but it seems like it should (in my head at least) 🙂

v-yujincui-msft
Community Support
Community Support

Hi @JPey ,

 

I have made a simple test for your reference.

 

1. Here is my Form.

vyujincuimsft_3-1655713093113.png

2. Here is my Flow.

replace(replace(outputs('Compose'),' ',''),',','')

 

range(1,div(length(outputs('Compose_2')),10))

 

substring(outputs('Compose_2'), add(mul(item(), 10), -10), 10)

 

substring(variables('phonenumber'),0,add(length(variables('phonenumber')),-1))

 

vyujincuimsft_1-1655712615695.png

vyujincuimsft_2-1655712941294.png

Result Screenshot:

vyujincuimsft_4-1655713165078.png

 

 


Best Regards,
Charlie Choi

JPey
Regular Visitor

Thanks, I'll try this out today and report back. 

@v-yujincui-msft when I try your flow, I enter the phone numbers copy and pasted from excel, into my long answer phone number question it looks like this

1111111111

2222222222

3333333333

 

The flow says it ran successful, but when I look at the compose 3 result, I get: 

1111111111\n2222222222\n3333333333
 
What I need compose3 to reflect is:
1111111111,2222222222,3333333333
 
Any idea on what I am missing?
 
v-yujincui-msft
Community Support
Community Support

Hi @JPey ,

 

Maybe you could try the following expression:

replace(replace(replace(outputs('Compose'),' ',''),',',''),decodeUriComponent('%0A'),'')

vyujincuimsft_0-1656036394444.png

Result Screenshot:

vyujincuimsft_1-1656036652301.png

 

 

Best Regards,
Charlie Choi

@v-yujincui-msft This is very close! When I enter the phone numbers question with:

1111111111

2222222222

 

I get the result: 1111111111222222222

I need the result: 1111111111,2222222222

 

The /n is gone, but there is no comma separation between the two numbers and the last numbers is missing a digit. I enter 10 digits for the second number, but the last digit is lost on the last phone number?

 

Any ideas?

v-yujincui-msft
Community Support
Community Support

Hi @JPey ,

 

Sorry i didn't reproduce this problem, it seems that works fine on my side.

vyujincuimsft_0-1656296495976.png

Result Screenshot:

vyujincuimsft_1-1656296560446.png

vyujincuimsft_2-1656296613766.png

vyujincuimsft_3-1656296634905.png

Maybe you could consider checking the run history and expressions(Note the name of the dynamic content in the expression).

replace(replace(replace(outputs('Compose'),' ',''),',',''),decodeUriComponent('%0A'),'')
range(1,div(length(outputs('Compose_2')),10))
substring(outputs('Compose_2'), add(mul(item(), 10), -10), 10)
substring(variables('phonenumber'),0,add(length(variables('phonenumber')),-1))

vyujincuimsft_4-1656297002258.png

vyujincuimsft_5-1656297122378.png

 

 

Best Regards,
Charlie Choi

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (4,009)