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

Split by new line does not work with Compose Output

Hi Community!

 

I’m stuck with a “split” function and was hoping someone can have a look into this?

 

Ref guide used:

https://powerusers.microsoft.com/t5/Building-Flows/Sliting-multiple-lines/m-p/92120/highlight/true#M...

 

I need to split something like this:

 

Line A

Line B

Line C

 

Line D

Line E

Line F

 

Into this:

 

[

  "Line A\nLine B\nLine C",

  "Line D\nLine E\nLine F"

]

 

But I’m getting this:

 

[

  "Line A\r\nLine B\r\nLine C\r\n\r\nLine D\r\nLine E\r\nLine F "

]

 

I manage to reproduce the problem I have with this TEST flow below that applies two different “Splits”. Only one works fine.

 

TEST flowTEST flow

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Variables:

 

Variables.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

TEST Flow explained:

Flow triggers when new file is created in OneDrive folder.

Then I need to Decode the file content and I get this output which looks fine

 

Decode64Decode64

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Then I take this output and split it using the new line that I set on “varNewLine” by pressing the “enter” key

 

SplitFileContentSplitFileContent

 

 

 

 

 

 

 

 

 

It doesn’t work

 

WrongOutput.png

 

 

 

 

 

 

However, if I put the same output I get from ‘DecodeBase64’ into “varText” and then split it using the same “varNewLine”, this works fine:

 

SplitVarText.png

 

 

Desired OutputDesired Output

 

 

 

 

 

 

 

 

 

As my real flow triggers when a file is created, do you know how can I get this split result above from a Compose output?

 

Many thanks in advance,

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Split by new line does not work with Compose Output

hi @santino1810 

 

first compose

split(encodeUriComponent(outputs('Compose')),'%0A%0A')

 

 second compose 

decodeUriComponent(string(outputs('Compose_2')))

 

output

out.PNG



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Split by new line does not work with Compose Output

hi @santino1810 

 

first compose

split(encodeUriComponent(outputs('Compose')),'%0A%0A')

 

 second compose 

decodeUriComponent(string(outputs('Compose_2')))

 

output

out.PNG



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

View solution in original post

Highlighted
Frequent Visitor

Re: Split by new line does not work with Compose Output

Hi Christian,

 

Thanks for your swift reply. 

I think my file has to be decoded with "decodeBase64" as it is not UriComponent
but "$content-type""application/octet-stream"
 
Sorry I forgot to mention that on my initial post.
Regards,

 

Highlighted
Frequent Visitor

Re: Split by new line does not work with Compose Output

Hi there,

 

Just to clarify, my first post showed a "test" flow with 2 splits on it. Only one does work, but it was there only to show my point.

This is the flow again with only the Split not working and for the one I need some help please:

 

TestFlow.JPG

 

SplitOutput.JPG

 

Thanks!

Highlighted
Frequent Visitor

Re: Split by new line does not work with Compose Output

Hi Christian,

 

I just got it now 😀

 

I had to use this instead:

split(outputs('Compose'),decodeUriComponent('%20%0D'))
 
Thanks!

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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