Im unable to set an object to a state inside a query

Im trying to prepare some data in a javascript query before calling a stored procedure in another query, but when i try to save the object to the state nothing happens

this is the code in my javascript query:

const arrayOfVencimientos = []
const valorCuota = form2SubmitToPrestamo.data.result[0].monto_prestamo / form2SubmitToPrestamo.data.result[0].cantidad_cuotas
const cantidadCuotas = form2SubmitToPrestamo.data.result[0].cantidad_cuotas
const comienzoPrestamo = form2SubmitToPrestamo.data.result[0].comienzo_prestamo

for (let i = 0; i < cantidadCuotas; i++) {
  const startDate = moment(comienzoPrestamo)
  const nextDate = moment(startDate).add(i + 1, 'M')
  
  arrayOfVencimientos.push(nextDate)
  
}

const objectToSave = {
  vencimientos: arrayOfVencimientos,
  valor: valorCuota,
  cuotas: cantidadCuotas
}

datosCuotas.setValue(objectToSave)


Hey @Trimux, Can you try console logging objectToSave directly above the line where you call datosCuotas.setValue(objectToSave)? Can you also share what datosCuotas is?