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 / Remove duplicates from...
Power Apps
Unanswered

Remove duplicates from string

(0) ShareShare
ReportReport
Posted on by 28

Hi,

 

I hope someone may be able to help me. I get the feeling this one is quite simple for some reason I just cannot get my head around the logic and formulas. Maybe I am still mentally stuck in Excel mode.

 

Anyway, I have a long string which is delimited by commas. I need to split it out, remove duplicates and put it back as a string again.

 

Any ideas? It is case-sensitive, if that matters?

Categories:
I have the same question (0)
  • Verified answer
    BhargavPatel Profile Picture
    660 Moderator on at

    @Scott_UK Try this:

     

    Concat(Distinct(Trim(Split(TextInputCanvas1.Value,",")),Value),Value,",")

     

     

    In my case, the input for TextInuptCanvas1.Value is:

    1,1,1,2,2,2,3,4,5,6,7,8,9,9,9,0,0,0,1,1,3,3,4,5,6,7,8,9,10,11,12,13,14,11,11,12,and,AND,aND,And, And,And

     

    And my output using the code I posted is:

    1,2,3,4,5,6,7,8,9,0,10,11,12,13,14,and,AND,aND,And



  • Scott_UK Profile Picture
    28 on at

    Hi,

     

    Thanks for the steer 🙂

     

    However, I get an error 'there is an error in this forumula' but oddly it doesnt highlight in red or say what part is wrong. Any ideas?

  • Scott_UK Profile Picture
    28 on at

    No matter, was operator error lol.

     

    Thank you for the formula, that works perfect 🙂

  • Gochix Profile Picture
    1,935 Moderator on at

    @Scott_UK ,
    You might have an error because the code that @BhargavPatel  provided is for textInput field, but you require the solution for the Text field?

    Then the code would be 

    Concat(Distinct(Trim(Split(Text.Text,",")),Value),Value,",")


    _____________________________________________________________________________________
    Please give a thumbs up if I resolved your issue! Please click Accept as Solution to close the topic!

  • Scott_UK Profile Picture
    28 on at

     Yes it was that lol.. must have needed my morning coffee. Thanks both.

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard