
Hello everyone,
Iām encountering an issue in my Power Apps application when I try to execute both a Set() function and a ForAll() loop in the same OnSelect action of a button.
Context:
ForAll() and Patch().Set() function in OnSelect to store the gallery data in a global variable.However, when I combine both functions (Set() to store the data and ForAll() to save the data to the Dataverse), I get errors.
Hereās the code Iām trying to execute:
Set(LastGalleryData; Gallery1.AllItems)
&
ForAll(Gallery1.AllItems; Patch(ETP_CAP_AAF; Defaults(ETP_CAP_AAF);{Site: Dropdown_BU.Selected.Value; Atelier: Dropdown_Atelier.Selected.Value; CAP: CAP.Text; Date: DatePicker.SelectedDate; 'Nombre d''ETP': Value(TextInput.Text); 'Date de crĆ©ation de la ligne': Now(); 'Date de modification': Now()}))What Iāve tried:
Set() code alone, it works perfectly.ForAll() code alone, it also works.OnSelect.Is there a specific way to execute both Set() and ForAll() in the same event? Or is there an alternative method for storing the gallery data while simultaneously patching it into the Dataverse?
Thanks in advance for your help!
ClearCollect(LastGalleryData; Gallery1.AllItems)
;;
ForAll(Gallery1.AllItems; Patch(ETP_CAP_AAF; Defaults(ETP_CAP_AAF);{Site: Dropdown_BU.Selected.Value; Atelier: Dropdown_Atelier.Selected.Value; CAP: CAP.Text; Date: DatePicker.SelectedDate; 'Nombre d''ETP': Value(TextInput.Text);
'Date de crƩation de la ligne': Now(); 'Date de modification': Now()}))