Hi Cute Bear,
(never tought I'd start a message like that on a professional forum š)
you don't need to do a aggregate inside a loop of questions for this, you can write an aggregate that transverses both foreign keys.
That would be an aggregate with 3 sources simply joined on both foreign keys :
- Response_choice with Question
- Question with Survey
- Where surveyId = to be copied survey id
But for this type of work, you might (depending on whether you feel ready for this) want to consider writing sql in the style of
create .... as select ....
Dorine
EDIT : oops, there's one little thing I wasn't thinking about : with this approach, you wouldn't know what foreign key to give the newly created response choice.
I think my approach would be to have that aggregate with 3 sources, sorted on id of question, have one single loop, check if there is a different question id, in that case create the question, and create every response choice you encounter, attaching it to the last created question.