cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yoshihirok
Memorable Member
Memorable Member

Sample - build a string from compose output values in apply-to-each.

I want to share how to build a string from compose outsput values in apply-to-each.

 

My scenario:

 In Apply-to-each, create new value for each item,

 After Apply-to-each, build a string by collecting new values.

 Like, Get Database records, Create new digest title from each record, After send a summarize mail by collecting the new digest titles.

 

Sample:

1. Compose: "@CeateArray(1,2,3,4,5)"

2. Apply to each

  2-1. Compose2: item

3. Compose:"@join(outputs('Compose2'), ',')"

1.png

 

Regards,

Yoshihiro Kawabata

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-micsh-msft
Community Support
Community Support

Hi @yoshihirok,

 

 

Thanks for the sharing!

 

Appreciated.

 

Regards,

Michael

Community Support Team _ Michael Shao
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

9 REPLIES 9
v-micsh-msft
Community Support
Community Support

Hi @yoshihirok,

 

 

Thanks for the sharing!

 

Appreciated.

 

Regards,

Michael

Community Support Team _ Michael Shao
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

Anonymous
Not applicable

Hi @yoshihirok,

 

I'm trying to build the workflow with quit the same funtionality, but every time I add a new action to join the texts, the "join action" wraps with "reapet with each" and as output I receive several join's. Could you suggest how to turn off auto addition of "repeat with each"?

Sketch.png

 

Sketch2.png

 

 

 

 

Kind regards,

Mikhail

 

Anonymous
Not applicable

I've realized that Join action has some different use, so used Compose intiad and it worked.

Hi, @Anonymous

 

I will re-create new Flow in this Flow Build, and reply any result.

 

and I post a Idea related do it.

Append a string to string type variable
https://powerusers.microsoft.com/t5/Flow-Ideas/Append-a-string-to-string-type-variable/idi-p/46198

for more flexibility flow.

 

Regards,

Yoshihiro Kawabata

 

 

Hi @Anonymous

 

I don't understand your cause of problem,

Try Compose with Join expression instead of Data Operations - Join action.

 

Instead of any help, I post a flow on today created.

 

1.png

 

 

1. Trigger: Schedule - Recurrence

2. Action: Data Operations - Compose

  Name = Compose

  Inputs = [ CreateArray(1,2,3) ]

3. Apply to each

3-1. Action: Data Operations - Compose

  Name = Compose 2

  Inputs = [ item() ]

4. Action: Data Operations - Compose

  Name = Compose 3

  Inputs = [ Join(outputs('Compose_2'), ', ') ]

5. Action: Microsoft Teams - Post message

  Message = [ Compose 3 - Output ]

 

This flow output "1,2,3".

 

-- [ <blue> ] is Expression.

-- [ <Purple> ] is Dynamic Content.

 

Regards,

Yoshihiro Kawabata

 

 

 

Hi @Anonymous

 

I post a idea related your problem.

 

"Data Operations - Join don't need 'Apply to each' flow. "

https://powerusers.microsoft.com/t5/Flow-Ideas/Data-Operations-Join-don-t-need-Apply-to-each-flow/idi-p/533821.png

 

 

 

Yes, 'Data Operations - Join' does NOT need 'Apply to each'.

Workaround, Can you use 'Join' expression Instead 'Data Operations - Join'

 

Regards,

Yoshihiro Kawabata

Anonymous
Not applicable

Hi @yoshihirok,

 

Thank you so much. I appreciate you help.

 

Now I understand that Join action can't be used in this situation. This is nothing I can find about it in the documentation and in which cases it can be used for.

 

Kind regards,

Mikhail

Hi Yoshihiro

Thanks for the suggestion.

In some complex flow (with nested apply to each for example), using a compose defined inside a apply-to outside its scope is not allowed. For instance the compose 3-1 scope is only restricted 3. Using it in 4 does not work always (in my case with nested apply to each)

 

3. Apply to each

3-1. Action: Data Operations - Compose

  Name = Compose 2

  Inputs = [ item() ]

4. Action: Data Operations - Compose

  Name = Compose 3

  Inputs = [ Join(outputs('Compose_2'), ', ') ]

 

With the recent support for "Append to Array variable" action, we can perhaps replace this with a different flow

 

2. Initialize TemporaryArray - array variable

3. Apply to each

3-1 Action: Append to array variable

Name= TemporaryArray

Value= [ item() ]

4. Compose

Expression: Join(variables('TemporaryArray'),';')

5. result we need is in Output('Compose')

 

2017-12-25_1924.png

 

 

 

 

ericshufro
Frequent Visitor

This doesn't work if the apply to each is within another apply to each.

Template error:
The action 'compose name' is nested in a foreach scope of multiple levels. Referencing repetition actions from outside the scope is supported only when there are no multiple levels of nesting.

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (2,080)