cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Wackmack88
Level 8

Remove in - concat code to create new break line in variable

Hi all,

 

I found a nice solution for my problem. I need to create a breakline in my variable and this works fine. 

 

https://powerusers.microsoft.com/t5/Building-Flows/How-do-i-create-a-variable-for-a-new-line-multipl... 

 

I use this solution but i can't remove the - in the concat code. Here is my code, it looks my join is not correct?

 

Compose - 

 

join(variables('Test'))

 

Compose2 with concat

 

concat(outputs('Compose'),'</br>')

 

 

Breaklines.png 

1 ACCEPTED SOLUTION

Accepted Solutions
AKRogers
Level 8

Re: Remove in - concat code to create new break line in variable

@Wackmack88,

 

As written above your first Compose action for the join() only has one value and not a separator.  In reviewing the original solution you linked, your second Compose action is missing the "replace" function. 

 

Are you trying to use "- </br>" as in the example, or do you just want the line break?  In either case, this is how I would do it instead:

 

10.png

 

11.png

 

12.png

 

Note that I initialized "test" as a string variable and used the Append to String Variable action in my Apply to each.  I used concat() to build the string for each line, with the </br> at the end.  If you also want the "-" at the beginning, simply add it to the concat function.

 

Let us know how it goes!

 

Ashley

 

If this response provided an answer to your question please mark it as a solution so that others can find it.

If you found this helpful, consider giving it a thumbs up!

View solution in original post

8 REPLIES 8
CollabTechie
Level 8

Re: Remove in - concat code to create new break line in variable

Hi @Wackmack88  - Try the below without /

 

concat(outputs('Compose'),'<br>')

 

-----------------------------------------------
If this was helpful, please give a thumbs up or accept as solution

Wackmack88
Level 8

Re: Remove in - concat code to create new break line in variable

I get an error with the first compose:

 

InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2657': 'The template language function 'join' expects two parameters: the array of elements to join as the first parameter, and the element separator as the second parameter. The function was invoked with '1' parameter(s). Please see https://aka.ms/logicexpressions#join for usage details.'.

AKRogers
Level 8

Re: Remove in - concat code to create new break line in variable

@Wackmack88,

 

As written above your first Compose action for the join() only has one value and not a separator.  In reviewing the original solution you linked, your second Compose action is missing the "replace" function. 

 

Are you trying to use "- </br>" as in the example, or do you just want the line break?  In either case, this is how I would do it instead:

 

10.png

 

11.png

 

12.png

 

Note that I initialized "test" as a string variable and used the Append to String Variable action in my Apply to each.  I used concat() to build the string for each line, with the </br> at the end.  If you also want the "-" at the beginning, simply add it to the concat function.

 

Let us know how it goes!

 

Ashley

 

If this response provided an answer to your question please mark it as a solution so that others can find it.

If you found this helpful, consider giving it a thumbs up!

View solution in original post

Wackmack88
Level 8

Re: Remove in - concat code to create new break line in variable

Wow! @AKRogers You made flow setup much more cleaner! I was using two times the compose options and now i only need the variable and the Append to string variable. |

I have one more question and then i'm done. I use almost the same flow, so again Get items and after that i need to multiple two columns. In PowerApps + SharePoint its very easy but what is the best way to do this?

 

I have to values Count + Price = total price. Whice method/directing should you advice to use?

AKRogers
Level 8

Re: Remove in - concat code to create new break line in variable

@Wackmack88 So glad I could help!

 

To do math functions, use expressions inside your Compose actions.  There are a bunch of math functions that you can use right inside the expression builder as well!

 

13.png

 

14.png

 

Hope that helps!

Ashley

If you found this helpful, consider giving it a thumbs up!

 

 

Wackmack88
Level 8

Re: Remove in - concat code to create new break line in variable

Really awesome! That will do the trick, thank you very much.

 

Have a nice day 😄

Wackmack88
Level 8

Re: Remove in - concat code to create new break line in variable

@AKRogers 

Can you please have an extra look. I got the mul syntax now but i didnt't get it with the concat option.

 

 

 

concat(items('Apply_to_each')?['Count'], '</br>')
concat(items('Apply_to_each')?['Pice'], '</br>')

 

 


This code works fine when i use create new item and then get item but how can i translate it to the concat?

 

 

mul(body('Get_item')?['Count'],body('Get_item')?['Price'])

I tried this: concat(mul(items('Apply_to_each')['Count'],(?['Pice'], '</br>'))) 

 

 

But it doenst work. Do you have a site or editor where i can learn to combine this syntax together?

Highlighted
AKRogers
Level 8

Re: Remove in - concat code to create new break line in variable

@Wackmack88, I think you're just missing a couple of things, so you're really close!

 

First, in your example you wrote "pice" instead of "Price."  Please double check the spelling of the fields in your expression just to make sure that's not interfering.  

Second, when using a field in an expression you need to use the entire "reference" to the field, which is what Power Automate so nicely hides from us when using Dynamic Content!  So, anywhere you want "Count" or "Price" in an expression, use the entire reference to the field:

 

items('Apply_to_each')?['Count']
items('Apply_to_each')?['Price']
 
Additionally, make sure that Count and Price are actually numbers and not strings at the time when you actually do math.  That might mean you need to convert them first using int() and then back using string() prior to using concat().
 
I find it's easier to break these apart into multiple compose actions during debugging, and then combine them into one compose action for production runs.
 
Take care!
Ashley

If you found this helpful, consider giving it a thumbs up!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,360)