cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User II
Super User II

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

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

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,

 

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!

Hi Christian,

 

I just got it now 😀

 

I had to use this instead:

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

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (9,492)