"Merge" action only returns one of the lists

Hey!

I created an alphabetical search that should return users whose first or last name starts with the chosen letter.

When I try the debugger, I can see that the first list (people whose first name starts with the chosen letter) returns right users and the last list (people whose last name starts with the chosen letter) returns the last users, but when they’re merged together, it only returns the last list.

What’s up with that? Did I misunderstand what “merged with” does?

Cheers!
Annaliis

The issue here is not about the “merge” operator. Your expression should return nothing.
Here is the list of what is wrong there:

  • The constraints are not applied because you have checked “Ignore empty constraints”.
  • Operator “contains” is used to check whether one Thing is present in the list of Other Things of the same type. This operator can’t be used for matching parts of words.
  • Also when you added the second “filtered” operator it is applied to both merged lists.

How to search for what you need:

  • create two fields on the User data type: First Letter First Name and First Letter Last Name
  • Run a workflow with one action: make changes to a list of things - First Letter First Name: First Name truncated to 1. Do the same for the last name. So you will store in the DB the first letters of the first and last name. Then you do the search using these letters fields.
  • do a search for a user, constraints: first letter first name IS [the reference to the filter letter].
  • merge this list with the same search for the last name.
1 Like

Thanks, works perfectly.
I actually have thought about this idea but didn’t want to create another field to the user. This can get quite slow with bigger databases. However, I’ll use it for now.

You would need to add a workflow that will add automatically the first letters to the users once they are created.

As to the search performance - it can be improved significantly once you feel it is slow. If the user data type in your app has a lot of fields it means that every search loads all of those fields. And you actually have two searches. You can create a lightweight data type specifically for this search. It could be the datatype “First Letter”. It might have fields: First Letter First Name, First Letter Last Name, Full Name.
Every time a new user is create a workflow creates the new First Letter and adds the reference to this First Letter to the User. Build the search with this lightweight data type. Once the name is clicked a workflow finds a user with the reference to the First Letter and it should be also quick.