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

8 REPLIES 8
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

 

 

 

 

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!

Users online (10,603)