No dupes in relation

Hi folks! I have this situation:

There is any way to have no duplicates at “Reniao_projeto” ?

Thanks in advance!

Eduardo

Hi @Eduardo_Dalcin, you can achieve this quite easily with a formula:

records = []
seen_projects = []
for r in Reuniao.lookupRecords(participantes=CONTAINS($id)):
    if not r.projecto in seen_projects:
        records.append(r)
return records

Note that this won’t remove any duplicates in the ‘Reuniao’ table. It just won’t show them in your column. Hope this helps!

1 Like

Or you may use Set:

tuple(Set(Reuniao.lookupRecords(participantes=CONTAINS($id)).projeto))
2 Likes

Thanks @TomNit and @jperon !

I used jperon’s approach and works fine! Except that “Set” must be “set”.

Thanks!

1 Like