Help

Re: Equivalent of a "find records" step in scripting app that allows more than 100 records to be found?

Solved
Jump to Solution
1554 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Alyssa_Buchthal
7 - App Architect
7 - App Architect

I have an automation that I need to count all records that meet a certain criteria. The number of records that meet this criteria exceeds 100, so the find records tool isn’t useful. There is a scripting block in the automation and I would like to count them there, but I’m not seeing an easy way to do this.

I only need the step to return the count of records that meet the criteria, not the actual records themselves. Has anybody done something similar?

Ideally I could make a view with the criteria filtered and then have the scripting step return the number of records in the view, but I don’t see any documentation for a function to fetch record count within a view in the API docs. Also don’t see a way to use selectRecordsAsync with an offset to capture all records that meet a criteria instead of just the 100 allowed by the function as it currently exists. Any thoughts?

1 Solution

Accepted Solutions
kuovonne
18 - Pluto
18 - Pluto

Read to the end of the thread to get how to use output.set so you can use the count in a future automation step.

See Solution in Thread

3 Replies 3

You have the right idea. Loading a query from a view will return an array of records. Like any array in javascript, doing array.length will give you the total number of items in that array, which in this case would be the count of records in that view.

let table = base.getTable("Table");
let view = table.getView("Criteria");
let query = await view.selectRecordsAsync({fields: []})

let records = query.records
let count = records.length
kuovonne
18 - Pluto
18 - Pluto

Read to the end of the thread to get how to use output.set so you can use the count in a future automation step.

Thank you! This is perfect.