Sep 14, 2023 10:18 AM - edited Sep 14, 2023 10:19 AM
Hi Everyone,
I have an idea that I am really struggling with and would appreciate some help.
Goal
Create a script/Automation that loops through table 1 to find matching record based on multiple conditions and link those records with table 2.
Base structure:
Listing
Listing contains all the properties we have in our portfolio and has various field types. For this specific idea, here are the ones that matter:
Opportunities
List of all active house searches we have for clients. For this specific idea, here are the ones that matter:
Idea
Example
Opportunity 1 has the following value:
The script should run through the listing table and identify properties with dynamic conditions based on the opportunities matching fields:
Then automatically link the identified properties with the Opportunity I am doing a search for (I would create a link record field in the Opportunity table to store them)
As you can see, I need to use
Any idea/ressources I could use to figure this one out? I was trying to solve it with airtable automation tool but couldn't find a way yet.
Thanks a lot for the help!
Mar 26, 2024 02:39 AM
Hi Kofal!
I was wondering if you had managed to achieve this project. I have a similar use case and I am trying to understand how the script would work as well as what's the best way to display the results. I am pretty new on Airtable so any recommendations are welcome!
Thanks!
Mar 26, 2024 04:32 AM
Hi @BenjaminM Welcome to Airtable.
Yes I was able to achieve something very close to what I had in mind. I would advise looking for a GPTs airtable script assistant (if you are low code). I literally built my script with it entirely.
Here is a script layout you can use for inspiration:
Function Definitions: The script begins with several function definitions, each calculating a score for a different matching criterion between an opportunity (buyer's preferences) and a listing (property details). These functions take in relevant parameters, compare them according to predefined rules, and return a score reflecting how well the listing meets the opportunity's criteria
Data Retrieval: The script prepares to fetch data from the "Opportunities" and "Listing" tables, defining the fields it will need from the "Listing" table.
Opportunity Record Retrieval: It retrieves values from the current opportunity record, such as minimum bedrooms, desired view types, budget range, etc.
Filtering step: You might want to add some filters before you loop through all your properties in order to optimize API usage (could be check the property status, filter by budgets, things like that)
Looping Through Listings: The script then loops through each property in the "Listing" table, filtering out those that do not meet basic criteria such as status, type, price, and region.
Scoring Each Listing: For each listing that passes the initial filters, the script calculates scores for each criterion using a scoring function (you need to define your scoring function before looping through properties. There are many ways to score this type of data (1 to 10, to 100, weighted scores, etc)
Calculating Total Score: It combines these individual scores into a total score for each listing (it needs to reflect your scoring method)
Sorting and Selecting Top Matches: The script sorts the properties by their total scores in descending order and selects the top matches.
Outputting Top Matches: Finally, it prepares the top matches for output, including their scores and other details.
Updating the Opportunity Record: The script concludes by updating the opportunity record with the top matching listings, linking them via a linked record field
What took time is understanding how to prepare the data for the different field types in airtable (single select, multiple select, numbers, text, etc). He has great tutorials on scripting: https://www.youtube.com/@AutomateAlltheThings
Hope that helps.
Mar 26, 2024 04:49 AM
Thank you so much, I appreciate your prompt and detailed reply!