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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Concat Dropdown items ...
Power Apps
Unanswered

Concat Dropdown items with if condition

(0) ShareShare
ReportReport
Posted on by 204

Hi Guys,

 

In my dropdown list I'm showing two items from my collection with the below code. This works fine.

 

SortByColumns( AddColumns(Types, "Mod&Des", Concatenate(MType, " - ", Description)), "Mod&Des")

 

 

However, when I'm missing either a Mtype or Description its still adding in the "-" as this is a string and will be included for every line of my collection.

 

Is there a way to add in an if formula when say the Description or Type is empty not to add in the "-", and only add it in when both values are there.

 

Any help is greatly appreciated.

 

Thanks

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @christian12 

     

    With({ccat: If(IsBlank(MType),Description,
     IsBlank(Description), MType,
     Concatenate(MType, " - ", Description)
     )},
     SortByColumns(AddColumns(Types, "Mod&Des", ccat, "Mod&Des", Ascending)
    )

     

  • christian12 Profile Picture
    204 on at

    @Drrickryp 

     

    Thanks although I'm getting an if error.

     

    FYI the Mtype & Description are two separate columns  in my Types collection. 

    Unsure if it is the IsBlank part of the code as it is not pointing to a collection/column which might be causing the error.

     

    Thanks again

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @christian12

    If they are choice columns you need to append .Value to the column names

     

  • christian12 Profile Picture
    204 on at

    No there not choice names

     

    Collection name:  Type

    MtypeDescription 
    22 
    33Blue
     Black
    44Pink

     

    End Result will look like this. (with also the sort functionality)

    MtypeDescription Mod&Des
    22 22
    33Blue33 - Blue
     BlackBlack
    44Pink44 - Pink

     

    The code for some reason doesnt work. I get the error column name conflict for 'Mod&Des'

  • Verified answer
    v-dezhili-msft Profile Picture
    Microsoft Employee on at

    Hi @christian12 ,

     

    Please try:

    SortByColumns(AddColumns(FH,"Mod&Des",If(IsBlank(Mtype),Description,IsBlank(Description),Mtype,Concatenate(Mtype,"-",Description))),"Mod&Des")

    vdezhilimsft_1-1673925703950.png

    vdezhilimsft_0-1673925614080.png

     

    Best Regards,

    Dezhi

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard