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,"*"," ")
Solved! Go to Solution.
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,
Can you please show me a screenshot of the error?
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,
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,
@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"
))