web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Concat and add to valu...
Power Apps
Answered

Concat and add to values but not the first and last value

(0) ShareShare
ReportReport
Posted on by 2,567

Hi

 

I'm trying to put all values from multiple columns together but filter out any empty columns, I have this working but I'm also adding

"<br>" for html formatting, now I don't want to add the <br> if there is only one item that is not blank. And I don't want to add <br> to the last item if there are multiple.

 

Concat(Filter([DataCardValue35.Text, DataCardValue36.Text, , DataCardValue37.Text, , DataCardValue38.Text], Value <> ""), Value&"<br>")

The above is giving me the format I want and filters out empty DataCards but I don't want to add <br> if there is only one item with a value and the rest are empty and I would also like to remove the last <br> or else I end up with break lines I don't need.

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @JimmyWork 

    Please consider changing your Formula to the following:

    With({_d: 
     Concat(
     Filter([DataCardValue35.Text, DataCardValue36.Text, 
     DataCardValue37.Text, DataCardValue38.Text], !IsBlank(Value)
     ), 
     Value & "<br>"
     )
    },
    
     Left(_d, Len(_d) - Len("<br>"))
    )

     

    I hope this is helpful for you.

  • JimmyW Profile Picture
    2,567 on at

    @RandyHayes Thank you so much

     

    This is working perfectly, now I just need to understand how the code works.
    I could you please short explain how this works, I can understand the functions Left, Len and With but you added _d: not sure how this all works together

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @JimmyWork 

    _d is just a variable name.  When you use a With function, what is defined in it is accessible for the entire Formula that is contained within the With.

    If you have a single value or need to reference the With variable, then you just specify a variable name.  Being a little lazy, I just called it _d - short for _data.

     

    So the bulk of the formula - the Concat - is done and assigned to a With variable called _d.  This is just to avoid typing the formula multiple times to get the same results.

  • JimmyW Profile Picture
    2,567 on at

    @RandyHayes Thank you for taking your time and answering me, always good to learn something new 😁

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard