cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AFWS
Regular Visitor

Apply to Each array problem

I'm pretty sure I'm doing something basic incorrectly. Here's the problem

I have a flow which brings in some plain text from a file and splits it into an array. It then builds a string from the array and attaches that to an email as a file. I've kept it simple right now, there'll be more trickery later, but I can't get this simple version to output the array values correctly using 'apply to each'.

 

 

image.pngSplit the content on SOL

 

 

 
 

image.pngOutput two ways, one is the text as assembled by apply to each, which consists of three lines exactly the same. The first line is array[0]

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @AFWS 

 

In your Append to string variable action, what is your expression? In my opinion it should just be "item()".

Kind regards, John

View solution in original post

3 REPLIES 3
AFWS
Regular Visitor

The crappy editor dropped two images

Shows apply to each pulling in the entire array as each line, rather than each item. Still knows it's three so it is reading the array as three lines. Note also it's got the array delimiters pulled in.

image.pngThe whole flowThe whole flow

Hello @AFWS 

 

In your Append to string variable action, what is your expression? In my opinion it should just be "item()".

Kind regards, John

Yes, bang on. Where is it written!?

I had assumed that's what the apply to each was looking for, each item in the array, not each array? It's a bit counter intuitive that it iterates the array not the items. And even then, why would it repeat for each item!

 

Thanks John.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,116)