Seraching according a feild in Airtable

Topic Labels: API
543 0
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

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//
    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
        return termDefinition
    // fetchNextPage()
}, (err: Error) => {
    console.error('Error: ', err)


0 Replies 0