Help

How to use the ReadonlyArray.find method

Topic Labels: Extensions
Solved
Jump to Solution
1224 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Guillermo_Ramo1
4 - Data Explorer
4 - Data Explorer

Hi.

Imagine that I have this:

let result = await table.selectRecordsAsync({fields: table.fields});

Navigating the API, I saw we can do this:

result.records.find(…)

but I cant’ fin any example. Can you explain how to use it?

Thanks in advance.

1 Solution

Accepted Solutions
Rupert_Hoffsch1
10 - Mercury
10 - Mercury

Hi @Guillermo_Ramos_Rui1,

so records.find() is simply using the Find() Javascript array method on the records array. Please read about find() here: Array.prototype.find() - JavaScript | MDN

Find requires a testing function inside and will give you the first array item that satisfied the function.

So something like: result.records.find(rec => rec.getCellValue("Name") === "Bob")

See Solution in Thread

1 Reply 1
Rupert_Hoffsch1
10 - Mercury
10 - Mercury

Hi @Guillermo_Ramos_Rui1,

so records.find() is simply using the Find() Javascript array method on the records array. Please read about find() here: Array.prototype.find() - JavaScript | MDN

Find requires a testing function inside and will give you the first array item that satisfied the function.

So something like: result.records.find(rec => rec.getCellValue("Name") === "Bob")