
Announcements
Hello!
I am trying to display duplicate items in a gallery but I am having a heck of a time getting it to work!
I am connecting to a Collection created from a SharePoint list.
I am able to highlight the duplicate items in the Gallery that are duplicates by using:
If(CountRows(Filter(Collect_AllMonths, 'Name' = ThisItem.Title))>1, Orange, White)
However I am not able to filter the gallery to only show all of the highlighted duplicate items.
Thank you!
Hi @Anonymous ,
Do you want to display all duplicate items in the gallery?
Would you like the duplicate items in the gallery to be shown in merged or separated?
And do you want an Icon to decide whether the gallery display all items or duplicate items?
I assume that you want an Icon to determine whether display all items or duplicate items and show them in a separated form, and bases on the assumption I made a test:
As you can see, I made the data source of the gallery manually filtered in two ways bases on a context variable applied on an Icon:
UpdateContext({Duplicate1:!Duplicate1})
In gallery’s Items property, use the formula kind like:
SortByColumns(If(Duplicate1,Filter(Ungroup(AddColumns(GroupBy(,'Name',"dupname"),"dup",CountRows(dupname)),"dupname"),dup>1),Collect_AllMonths),'Name',If(SortDescending1, Descending, Ascending))
The formula first group the collection by the column Title and duplicate records in the table of the ”dupname” field, then add a column to store the results of CountRows(), then Ungroup and we get a table with a column of "dup" in which are the count of lines, we only need to filter the result of >1 which means more than one record.