Hello all,
I am working on a survey system. I have a gallery to show the datasource from SharePoint list. It works fine.
For submit button, I want to create new record if record does not exists and update the answer if it exists.
Below is two function, it works flawlessly.
// Create new record
ForAll(
SurveyGallery.AllItems,
( Patch(
Test_Answer_List_v2,
Defaults(Test_Answer_List_v2),
{
Question_Id: Value(Label12.Text),
User_Email: User().Email,
Answer: TestAnswer.Selected.Value,
Title: "test"
}
) )
);
// Update the record if exists (Question_Id and User_Email) both match
UpdateIf(
Test_Answer_List_v2,
And(
Question_Id = Value(Label12.Text),
User_Email = User().Email
),
{Answer: TestAnswer.Selected.Value}
)
However, now I have a problem, seems if statement cannot work in ForAll Function.
Is it possible to do something like this in ForAll() function?
ForAll()
if (User_email = user_email && Question_Id = QuestionId)
then update record
else create new record
Anyone have a idea? thanks

Report
All responses (
Answers (