cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft
Microsoft

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
Highlighted
Community Support
Community Support

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
Highlighted
Dual Super User II
Dual Super User II

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.
Highlighted
Microsoft
Microsoft

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\"]"
}

 

Highlighted
Microsoft
Microsoft

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?

Highlighted
Dual Super User II
Dual Super User II

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.
Highlighted
Community Support
Community Support

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

Highlighted
Microsoft
Microsoft

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,149)