Client-side storage to RESP API - can't save

Please help me! I have one “table” (ServicosTM) in client-side and can’t save in RESP API… (table Servico) I try use the command ‘Create record’ an formule, but return to me one message of incompatible… “The type 'list of objects with 1 property is not assignable to the type 'object with 1 property”…

I don’t know how I can transforme one of the objects to same type… both seem equals for me (struture)…

Hi @Rubem_Andrade, it is incompatible because ServicosTM is a “list of objects with 9 properties” and Servico is an “object with 9 properties”.

OK, thanks, but how I can ajust ? I create other ServiceTM2 with a object, but they return the same error…How I can create the similar objects?

I change both for list of objects… but dont work…

Hi, in Create record, you are creating one new record (one object) to the database:

For example, if the database is data.fruit = [{name: banana, amount: 5}, {name: mango, amount: 10}]

Create record ( {name: kiwi, amount: 2} )data.fruit = [{name: banana, amount: 5}, {name: mango, amount: 10}, {name: kiwi, amount: 2}]

That’s why the resource needs to be of type object with properties if you want to use it in Create record :slight_smile:

If you have a client-side list of objects data.localStorageFruit = [{name: apple, amount: 5}, {name: banana, amount: 2}]

You can use data.localStorageFruits[0] to access the first object in the list, and so on.

So in this case, if we already added the kiwi, Create record ( data.localStorageFruit[0] )data.fruit = [{name: banana, amount: 5}, {name: mango, amount: 10}, {name: kiwi, amount: 2}, {name: apple, amount: 5}]

You can use data.localStorageFruits[0] to access the first object in the list, and so on.

How I create this loop to insert the registers in appgryve?