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

How to split array into a datatable or html text box

I have an array that I store in a collection and currently I can dump the data into a data table.  I've been struggling on how I can split that array by ",".  I've tried the split function, but have had no success.  I'm also not entirely sure where the split function should be entered, either at the trigger (the button) or the datatable piece.

 

split(collection,",")

  

Screen Shot 2019-06-03 at 4.23.27 PM.png

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How to split array into a datatable or html text box

Hi @robevans ,

Could you please share a bit more about the result the DEV_HSRedaction.Run() formula returns? Just like ["done", "done", "done", ...., "done"] (a string value)?

Do you want to split the ["done","done","done", ...] string value into an array into a Data Table?

 

Based on the needs that you mentioned, I think the combination of Substitute function and Split function could achieve your needs.

I have made a test on my side, please take a try with the following workaround:6.JPG

 

7.JPG

Set the Items property of the Data Table2 to following formula:

Split(
Substitute(
Substitute(
Substitute(
Substitute(First(datafromflow).Value, "[", ""),
"]",""
),
"'",""
),
" ",""
),
","
)

On your side, please set the Items property of the Data Table control to following:

Split(
      Substitute(
                  Substitute(
                               Substitute(
                                          Substitute(First(datafromflow).Value, "[", ""),
                                          "]",""
                               ),
                               "'",""
                  ),
                  " ",""
      ), 
      ","
)

More details about the Substitute function and Split function, please check the following article:

Substitute function, Split function

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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

6 REPLIES 6
Dual Super User
Dual Super User

Re: How to split array into a datatable or html text box

Do you actually have an array or a comma delimited string stored in the collection.  When I create a collection using the following code I can bind the collection directly to the datatable and each array value becomes a row.

 

ClearCollect(mytable,["Test1","Test2","Test3"]) 

 

Can you provide a screen shot of what is in your collection after you load the array?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
robevans
Level: Powered On

Re: How to split array into a datatable or html text box

So here's my button code that collects the data from Flow Array and also what my table looks like. 

 

 

Screen Shot 2019-06-04 at 2.15.30 PM.png

 

 

Screen Shot 2019-06-04 at 2.15.22 PM.png

 

Here's the body being sent over from Flow.

 

{
  "vardata": "[\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\",\"done\"]"
}

 

robevans
Level: Powered On

Re: How to split array into a datatable or html text box

On second look the type is a String and not an array being sent from Flow.  This should still allow to split though?

Dual Super User
Dual Super User

Re: How to split array into a datatable or html text box

Yes, it should allow split.  The issue may be how it interprets the string.  The escaped double quotes may still cause an issue.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Community Support Team
Community Support Team

Re: How to split array into a datatable or html text box

Hi @robevans ,

Could you please share a bit more about the result the DEV_HSRedaction.Run() formula returns? Just like ["done", "done", "done", ...., "done"] (a string value)?

Do you want to split the ["done","done","done", ...] string value into an array into a Data Table?

 

Based on the needs that you mentioned, I think the combination of Substitute function and Split function could achieve your needs.

I have made a test on my side, please take a try with the following workaround:6.JPG

 

7.JPG

Set the Items property of the Data Table2 to following formula:

Split(
Substitute(
Substitute(
Substitute(
Substitute(First(datafromflow).Value, "[", ""),
"]",""
),
"'",""
),
" ",""
),
","
)

On your side, please set the Items property of the Data Table control to following:

Split(
      Substitute(
                  Substitute(
                               Substitute(
                                          Substitute(First(datafromflow).Value, "[", ""),
                                          "]",""
                               ),
                               "'",""
                  ),
                  " ",""
      ), 
      ","
)

More details about the Substitute function and Split function, please check the following article:

Substitute function, Split function

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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

robevans
Level: Powered On

Re: How to split array into a datatable or html text box

Thanks @v-xida-msft that worked for the most part.  Except the quotes are still present before and after done for me, but your screenshot is showing as removed.  Did I miss a step?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,764)