I am looking for a way to filter for duplicate entries. In our case, I would like to send an email to the corresponding companies of our customers of a certain appointment. Sind the company books for more than one participant, I need to filter the duplicate entries of the company name.
Do you have an idea on how to solve it?
Hey Tom. This is mostly outside of my scope but I know we can use lodash in Tape and a quick search brought back this in the Lodash Documentation This should do exactly what you need.
Creates a duplicate-free version of an array, using SameValueZero
for equality comparisons, in which only the first occurrence of each element is kept. The order of result values is determined by the order they occur in the array.
_.uniq([2, 1, 2]);
// => [2, 1]
Hi @tom.goeckeritz,
thanks for reporting this (and also a warm welcome from my side here in the Tape community)!
Always a pleasure to see real world scenarios being implemented in Tape.
Just to be sure, let me rephrase your scenario as I understood it:
- An appointment has many participants
- A participant belongs to a company
- A company has a company email that you would like to send the appointment related email to
So basically, you would like to email all related organisations (via the participants) for a single or for multiple appointments?
There are many ways to remove duplicates using code (also thanks to @1F2Ns, nice idea of introducing lodash here!), but I am brainstorming right now whether you can solve that even easier. The Tape search and filter already does a deduplication by record, so the same record would never occur more than once in a result set. Of course, this has the prerequisite that each company only exists once and has no equal duplicates.
What you should be able to do in this case, is to perform these two steps:
- (1) Get related participants for the appointment
- (2) Get related organizations for the participants of (1)
You can do both steps in one “Get related” action, by clicking the “Add follow” button you can “navigate” along your app relations and should be able to retrieve all related organizations for the appointment - removing duplicates.
Could you try this approach and let me know how it goes? If it does not work, it would be great if you could add more context, a couple of screenshots of your existing workflow automation so I can assist you better. Of course we can also work out a code solution that will basically be able to solve anything.
Looking forward!
Thanks for your input
Cheers
Tim
Wow what a great and quick feedback. Thank you both for your support. I took the non-scipt-way of Tim and it worked. I’ll have a look into Lodash. I think I’ll need that for future projects.