Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: Script to go over the 100 found records limit

2629 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Joachim_Brindea
6 - Interface Innovator
6 - Interface Innovator

Hello, 

I'm in need of a script to circumvent the 100 found records limit.

Here is my use case:

I have a database of 2k records updated on a weekly basis.
The user can setup and save complex filters (what I call alerts) to get a weekly email with new records.
My automation searches in the [aides] table for records matching the criterias for the [alerte] record.

Joachim_Brindea_0-1673688866000.png

It then links the relevant [aides] records to the [alerte]

Joachim_Brindea_1-1673688924272.png

My issue is that it can only find 100, and I don't know how to do a script to replace the find records step.

Thank you very much for your help.

Cheers,

Joachim

4 Replies 4
Josh_Greenplate
4 - Data Explorer
4 - Data Explorer

Are you wanting to send an email with more than 100 records in it? I'm pretty sure that could get truncated by many email providers. Either way, to get around the limitations, Could you build out a view with the same filters and then share the view link?

No no 😂

The alert is like a watchlist.

User goes to their profile and can open his watchlists.

He receives an email every week with the latest additions as a bulleted list (usually 1 to 10).

I would like the watchlist to be complete even if his criteria matches more than 100 records.

I could share a view if I had a few users, but I want to make it as lean and automated as possible.

So really a script that does exactly what the find records step does would be a perfect fit, the only point is to overcome the 100 records limit.

Ah, I think I see what you are doing. It's quite clever to allow them to fill the filter criteria like that. I'm not as familiar with scripting so hopefully someone else chimes in on that.

When learning how to script "Find Records" within a script, it's easier if you take a step back from Automation and instead create a Scripting App Extension to write and test some code.

For example, this is my "Candy" base that I use for testing ideas (please don't ask me what "MeowMeow" colour is... 🐈 )

Karlstens_0-1673742714095.png


I need to "Find Records" on certain "Nominated flavours". To demonstrate how this can be done with JavaScript, I've taken the idea into the Scripting App and written the below;

Karlstens_1-1673742862831.png

I haven't spent much time polishing the search, as perhaps when a user types "Apple", we want it to return both "Apple" and "Pineapple" - fuzzy logic will depend on your own base/search requirements. However, to simply return an exact match (that's not case sensitive)

output.markdown('# Candy Finder!');

let userInput = await input.textAsync('What are you finding in the "Nominate Flavour" field?');
output.text(`// Checking if ${userInput} exists in "Nomintae Flavour".`);

const candyTable = base.getTable("Candy Code")

const allCandyRecords = await candyTable.selectRecordsAsync({
    fields:["Product Code", "Nominate Flavour"]
    });

const foundResults = allCandyRecords.records
    .filter( record => record.getCellValueAsString("Nominate Flavour").toLowerCase() === userInput.toLowerCase());

console.log(foundResults.map( record => record.name))

 And this returns the user with an array of records that match the string;

Karlstens_2-1673743130158.png

Once you have an understanding of JavaScript methods such as .filter() and .map() (and there are others too that you should also learn, such as .reduce() and .forEach() ) and you get the general idea of this script working within the Scripting App Extension, it's usually fairly easy to get your Scripting App code then working within an Automation with minimal tweaking.

I hope this helps you, let me know if you have any questions.