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 / District from Concat a...
Power Apps
Answered

District from Concat and Concatenate

(0) ShareShare
ReportReport
Posted on by 224

I seem to be stuck trying to get Distinct emails from a collection and emails from a predefined string value combined together.

 

Below is what I have, but the Value is not recognized.

Distinct(Concatenate(Concat(colManagerEmails,Value," ;"),"; abc123@gmail.com"),Value)

 

 

Below is the OnSelect for a Button that Collects the colManagerEmails from all the SP items shown in Gallery1 

Collect(colManagerEmails,Distinct(ForAll(Gallery1.AllItems,Office365Users.ManagerV2(ThisRecord.'aCreated By'.Email)),mail))

 

I'm trying to combine the colManagersEmails value in the Concat and then Concatenate the collection with a predefined string of Email values.

 

Can someone point me in the right direction? 

Categories:
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @as733y 

     

    You use Distinct after fetching manager emails for the colManagerEmails collection. An second Distinct (first code block) is not necessary. Additionally, Concatenate will return a text value - resulting in the Value error.

     

    Removing the Distinct should solve the issue:

    Concatenate(Concat(colManagerEmails,Value," ;"),"; abc123@gmail.com")

     

    In case the added text can also contain one of the already existing emails, you could (1) choose to add the predefined mails to the collection or (2) filter out the duplicates when running the first code block.

     

    Option 1: adding predefined mails to the collection (moves logic to the collect function)

    Collect(
     colManagerEmails,
     //Return only the unique mails
     Distinct(
     //Merge both tables
     Ungroup(
     [
     //Fetch selected users' managers mails
     ForAll(
     Gallery1.AllItems,
     Office365Users.ManagerV2(ThisRecord.'aCreated By'.Email).mail
     ),
     //Add predefined emails
     [
     {mail: "PredefinedMail1@email.com"},
     {mail: "PredefinedMail2@email.com"}
     ]
     ],
     "Value"
     ),
     mail
     )
    )
    
    //Your first code block would look as follows:
    Concat(colManagerEmails, Value, " ;")

     

    Option 2: Filter out duplicate values within the first code block (your collect function will remain as is)

    With(
     {wPredefinedMails: "; abc123@gmail.com"},
     Concat(
     Filter(colManagerEmails, !(Value in wPredefinedMails)),
     Value,
     "; "
     ) & wPredefinedMails
    )

     

    If this solves your question, would you be so kind as to accept it as a solution.
    Thanks!

  • as733y Profile Picture
    224 on at

    @LaurensM Thank you for taking time out to explain the 2 options. I went with option 1.

     

    I'll have to read more about the Ungroup function, that seems to be the thing I was missing to connect everything else I had.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard