How to retrieve multiple data from the database?

Hello everyone
I’m trying to fetch multiple data from an object like this {[{"dish":"......", "quantity": ...},{"dish":"......", "quantity": ...},{"dish":"......", "quantity": ...},...,{"dish":"......", "quantity": ...}]}.
If I’m writting {{{variables.db_response.records.0.dish}}} or {{{variables.db_response.records.0.quantity}}}, it onlys fetches 1 record and I want to fetch every single record. What should I do?

Hi @Ayush_Chaudhary ,
Create a function and parse

let records = data.variables.db_response.records
1 Like

Hey @Subhrajit_Gupta
Thank you for your response. Can you elaborate more?
Actually what I have to write in the function?

1 Like

Yes.
You have to create a function, extract the data from the variable that stored the DB response.
Write

let records = data.variables.db_response.records
console.log(records, "records")

Log the result and check the data.
Post this you can do what you want with the data as per the use case.

1 Like

Thank you @Subhrajit_Gupta


I could retrieve the data I wanted using the above code.

image
:blush:

1 Like