Hi All,
I have been building an app for a week now. It is an update on a previous app.
It seemed to be operating fine until recently it is now taking ages to patch into a DB and I am getting the following Error



Previously I manually added toggles onto a screen and then once the save button was clicked it would patch through to a database once.
I have recently changed my layout to use a gallery for each question then saved to a collection and then at the end a ForAll and Patch function to save the results in the collection to the SQL Database.
Is there a better way of doing this? Sometimes I may have up to 20 Questions on a page.
Here is my code:
ClearCollect(
Answers,
ShowColumns(
AddColumns(
QS_Questions.AllItems,
"QuestionID",
QS_Q_ID.Text,
"Answer",
QS_Q_Answer.Value
),
"QuestionID",
"Answer"
)
);
ForAll(
Answers,
Patch(
'[dbo].[answers]',
Defaults('[dbo].[answers]'),
{
q_id: QuestionID,
q_group: QS_CatID_Lbl.Text,
answer: Answer,
visitid: Var_VisitID
}
)
);
Patch(
'[dbo].[q_notes]',
Defaults('[dbo].[q_notes]'),
{
notes: QS_Notes.Text,
q_group: QS_CatID_Lbl.Text,
visitid: Var_VisitID
}
);
Navigate(
Category_Menu,
Fade
)