cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Mark duplicate names in a Listbox with a * is there is more than one with that name

Hello!

 

So I get several items with a people/group column in it thats inside a listbox inside a gallery. Sometimes the same name appears and then I want to get a fast indication for that.

 

Can I create a label with a "*" in it and place in the gallery that count the rows somehow and recognize if there is duplicates?

 

Something like this? But it wont work:

If(CountRows(Filter(Logg;Names.Displayname = "Duplicatevalue")) > 0,"*"," ")
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

Well, for person field that allows multiple value, formula will be different.

Try to set like this:
1)the screen's OnVisible:

ClearCollect(test,
                Filter(
                       AddColumns(
                                 GroupBy(Ungroup(Logg,"Names"),
//split records
                                         "DisplayName","samename"
                                         ),
//group based on displayname
                                 "num",CountRows(samename)
                                  ),
//count rows with the same displayname
                        num>1
//get the displaynames that with duplicate value
                        )
            )

2)set the gallery's Items:

Logg

3)set the label's Text inside the gallery:

If(true in 
          ForAll(test,
                 !IsEmpty(
                          Filter(ThisItem.peo,test[@DisplayName] in DisplayName
                                 )
                          )
                  ).Value,
//filter Logg items whether displayname in currect item is included in the collection
    "*","")
//if true, then displayname is in duplicate names connection

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
KranthiTupakula
Responsive Resident
Responsive Resident

Can you please show me a screenshot of the error?

v-yutliu-msft
Community Support
Community Support

Hi @Anonymous ,

Do you want to mark items with duplicate names "*" in a gallery?

Could you tell me whether Names field allow multiple value?

The key point of your issue is that there's no constant duplicate names to directly compare, so using filter rule like this will not work.

 

Names.Displayname = "Duplicatevalue"

 

 I assume that your Names field is a single person field.

Then you could set like this:

1)the gallery's Items:

 

AddColumns(
         GroupBy(
                AddColumns(Logg,"name",Names.Displayname),
                           "name","samename"
                          ),
                "num",CountRows(samename)
           )

 

//group based on namevalue, then add a column to count the rows

2)insert a label in the gallery

set the label's Text:

 

If(ThisItem.num>1,"*","")

 

//display "*" based on the new column num value.

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-yutliu-msft 

 

The namefield allows multible values. I can choose and add several people into the column.

 

Can you change your provided code so it allows multible values to check?

 

Thanks!

Hi @Anonymous ,

Well, for person field that allows multiple value, formula will be different.

Try to set like this:
1)the screen's OnVisible:

ClearCollect(test,
                Filter(
                       AddColumns(
                                 GroupBy(Ungroup(Logg,"Names"),
//split records
                                         "DisplayName","samename"
                                         ),
//group based on displayname
                                 "num",CountRows(samename)
                                  ),
//count rows with the same displayname
                        num>1
//get the displaynames that with duplicate value
                        )
            )

2)set the gallery's Items:

Logg

3)set the label's Text inside the gallery:

If(true in 
          ForAll(test,
                 !IsEmpty(
                          Filter(ThisItem.peo,test[@DisplayName] in DisplayName
                                 )
                          )
                  ).Value,
//filter Logg items whether displayname in currect item is included in the collection
    "*","")
//if true, then displayname is in duplicate names connection

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-yutliu-msft  I cant get this to work with my current filter in my gallery. I implemented "test" in my current filter in the gallery but wont work. If I only have "test" and then it seems to work. But I want to keep my filter also.. I dont get any errors, but it simple wont show anything in the gallery.

 

If('Toggle'.Value;
Filter( 
   Sort(test;'Contact';Ascending);
Avtalsområde.Value = "Öst" ||
Avtalsområde.Value = "Norr";
Status.Value = "Ongoing" ||
Status.Value = "Finished"
   );
Filter(
   Sort(test;'Contact';Ascending);
       Avtalsområde.Value = v6 || Avtalsområde.Value = v7;
       Status.Value = "Ongoing" ||
Status.Value = "Finished"
   ))

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,384)