When using the action "Lookup Single Row in Other Table", but the table contains 2 rows with the same lookup value. Which one will be chosen?
The "Lookup Single Row in Other Table" action is designed to return only one row from another Clay table, even when multiple rows match your lookup criteria. [1] However, the documentation doesn't specify which row gets selected when there are multiple matches with the same lookup value.
Which filter operator are you using for your lookup, and what type of data are you searching for?
I'm using equal. I'm using domain as a lookup value. However, the table connected table does contain duplicates (it's a cache for enrichments, where we store all enrichments)
We just want to return the most recent one
The "Lookup Single Row in Other Table" action returns only one row when multiple matches exist, but our documentation doesn't specify which row gets selected in these cases. [1]
For your use case where you need the most recent enrichment from your cache table, consider using "Lookup Multiple Rows in Other Table" instead, which can retrieve all matching rows. You could then use additional logic (like sorting by creation date or using AI) to identify the most recent entry from the returned results.
What's the structure of your cache table - do you have a timestamp or "Created At" column that indicates when each enrichment was added?
Okay, and how do I select the most recent one?
After using "Lookup Multiple Rows in Other Table" to retrieve all matching rows, add a "Use AI" action that references the lookup output. Create a prompt asking AI to identify the most recent entry using the Created At column. [1]
The AI can analyze the returned rows and select the one with the most recent timestamp from your cache table.
Is that what you were looking for?
This is not really helpful. I don't want to spent AI credits on this. Could you just tell me which row would be retrieved when I use the lookup on a single row?
I understand your frustration, and I’ll connect you to a human agent who can provide more detailed assistance.
Clay Support is sharing a file with you.
Our support team has got your message and we'll get back to you soon! We're currently outside of our standard office hours (9 AM to 9 PM EST, Monday through Friday), so it may take a little longer for us to respond.
If you’re dealing with a specific table, drop the URL below so we can help you quicker. Otherwise, someone from our team will be in touch soon!
Hey Michael! Thanks for reaching out. Happy to help. It will choose the first row that matches in the table. If the goal is to pull both rows, we recommend using the "lookup multiple row" action. Let me know if this helps!
Hey Daniela D.. Thanks for the explanation. Do you mean the first row based on the sorting that I set?
Happy to help! To clarify, it chooses basedon the oldest version of the record, not the table sorting.
Okay thanks. I assume this cannot be changed to newest? Daniela D.
