Reputation: 1
I'm new in Flutterflow and trying my first project.
I have a collection called Igrejas that contains a map (list) array field structure called membros.
I need to update an Igrejas document filling-up this membros array structure using the data from another collection documents with same layout fields, called TempMembros.
I'd like to use button called actions to achieve this.
I have tried to use query based list views and action queries followed by update documents, but in the action update document, I got stuck, because there is always another option listto select from like (first items, item at index..., and so on).
Any clues to do this ?
Thanks in advance.
Roquevalder.
Button action created
After several test and tries, I have managed a way to contour the problem.
First of all, my misunderstanding was about data structures, specially in relation between the membrosTemp collection structure and the membros structure inside the Igrejas collection, although both have the same sub-fields(nome, grupo, situacao, categoria and sexo).
My contour solution was:
Igrejas collection (the one to be updated):
codigrej - string
igreja - string
membros (map structure list) with:
-nome - string
-grupo - string
-situacao - string
-categoria - string
-sexo - string
TempMembros collection (to one to provide data to update):
nome - string
grupo - string
situacao - string
categoria - string
sexo - string
The main issue of this contour solution is too many update calls to Firebase, as I am issuing one update action on Igrejas collection document for each one of the membros item added, what in my opinion should not be necessary, as membros is just a structure inside the Igrejas document.
I'd prefer a way to add all the TemoMembros record in some app state variable, let's say, membrosCarga (some list type variable), and then update just once the Igrejas document, making membros structure = membrosCarga. Unfortunately, I could not accomplish that, after dozens of tries.
Any suggestions are very appreciated.
Action reading TempMembros Collection
Action reading Igrejas Collection
Action trying to update Collection igrejas from Collection TempMembros output
Upvotes: 0
Views: 24