Remove all items form list which is related to an object and commit an empty list

0
Hello,   My app contains a list of questions and a list of answers to these questions. Upon edit of answers I want to overwrite all answers related to the question with new answers. For this I have 2 lists, first which is a list of Answers (Option) and second which is Temporary Answers (TempOption) which I use to store answers until they are saved by the user. Currently in order to overwrite all answers in the main Answers list with new options I do the following: retrieve both lists loop through first and delete each object loop through other and set its association to Question commit TempAnswers You can see how it looks below:   My question is: Is there a better way to do this? Can I assign new Options without having to loop through each one? Can I somehow replace options list associated to Question without the need to delete each one?
asked
1 answers
1

Looks like a fine flow for achieving what you describe. Since Question has a *-* relation to Option (or Answer) you will not be able to use 'Set' for Question to override the existing association(s) to Option. There for you will indeed need to loop over TempOption.

You can simplify this flow a bit by replacing the Loop over Option + the commit by one Delete activity.

 

There is a CommonityCommon activity 'copyAttributes' but that does not copy the associations.

answered