cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pwrappr01
Level: Powered On

Help! How can I return only the first character after each occurrence of a delimiter in a string?

I am trying to break apart all of the answers selected for a multiple choice question in an MS Form. Here is a sample of the result that is returned, which I am storing inside a Compose action called Q1Answers:

 

"[\"(1.1) M Query\",\"(1.2) DAX \",\"(1.3) LRQ\",\"(1.4) MDX\"]"
 
I am wanting to use Power Automate to split the returned value so that only the number after each period will show in a list. My desired result is as follows:
 
1,2,3,4
 
Anyone have ideas? I had some slight success in that I have returned the first and last items (1,4) using the formula below, but it is a beast and I cannot figure out how to get it to return EVERY answer for EVERY occurrence. I am also not wed to this formula, so anything helps. 
 
IF(EQUALS(Indexof(outputs('Q1Answers'), '.'), lastIndexOf(outputs('Q1Answers'), '.')), substring(outputs('Q1Answers'), ADD(Indexof(outputs('Q1Answers'), '.'), 1), 1), CONCAT(substring(outputs('Q1Answers'), ADD(Indexof(outputs('Q1Answers'), '.'), 1), 1), ',', substring(outputs('Q1Answers'), ADD(lastIndexOf(outputs('Q1Answers'), '.'), 1), 1)))
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Help! How can I return only the first character after each occurrence of a delimiter in a string?

 

Hi @pwrappr01 ,

 

Please try to refer to the following method to configure Flow.

First, use the specified expression to convert the response into the desired format, and then extract the required data.

Expression reference:

split(replace(replace(replace(outputs('Compose'),'","',','), '["',''), '"]',''),',')

Image reference:

44.PNG45.PNG46.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Help! How can I return only the first character after each occurrence of a delimiter in a string?

 

Hi @pwrappr01 ,

 

Please try to refer to the following method to configure Flow.

First, use the specified expression to convert the response into the desired format, and then extract the required data.

Expression reference:

split(replace(replace(replace(outputs('Compose'),'","',','), '["',''), '"]',''),',')

Image reference:

44.PNG45.PNG46.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

pwrappr01
Level: Powered On

Re: Help! How can I return only the first character after each occurrence of a delimiter in a string?

That worked great; thank you!

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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
Top Kudoed Authors
Users online (4,176)