Seraching according a feild in Airtable

Hi everyone, I am writing a micro-service where I want to accept a field, look for its record, and return with data from its record. Ideally, I also want to make it not case-sensitive. But I am having multiple issues with it. Firstly, unwrapping the string is “SELECT” is not working for me. It works if I just pass a string but not when I try to unwrap a variable (according to a solution I found on this forum. Secondly, how do I make it not case sensitive? is this possible if I have to write something custom (as in fetching everything and manually search through).

Here is my current code.

export const getDefinition = async (userInput: String) => {
console.log('this is from getDefinition!!!', userInput)

//configure Airtable//
Airtable.configure({
    endpointUrl : process.env.AIRTABLE_URL,
    apiKey: process.env.AIRTABLE_API_KEY
})


const data = base(process.env.AIRTABLE_TABLE_NAME).select({
    filterByFormula : `{term} = "${userInput}"`
}).eachPage((records: any, fetchNextPage: any) => {
    records.forEach((record: any) => {
        let termDefinition = record.fields.definition
        console.log(termDefinition)
        return termDefinition
    })
    // fetchNextPage()
}, (err: Error) => {
    console.error('Error: ', err)
})

}

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.