I create a collection from a list on app start. When i create or edit an item using a form i want to add this changes or new items to this collection. (col_Activitati)
I manage to create the formula for edit changes to an item , but i can find how to add new item to collection when i click submit button on the form. Bellow it's the code:
I have 2 buttons on main screen, add for adding new items, when it's click the form is in new mode, and edit and the the form it's in edit mode.
Formula for submit button it's working for the edit mode.
If(FormTask.Mode=FormMode.Edit,
Patch(col_Activitati,LookUp(col_Activitati,ID=Gallery1.Selected.ID),FormTask.Updates), and next must continue with the else part where add item to the collection when the form is in new mode.
Thank you
Thank you, it's working. I try to work with collections instead of using data source when show gallery items in this case , because loading taking long time because of number of items.
Yes - you need the name of the list (that was a typo of mine), but what you are doing is a little unusual - try this
If(
FormTask.Mode=FormMode.Edit,
Patch(
col_Activitati,
{ID:Gallery1.Selected.ID},
FormTask.Updates
),
Collect(
col_Activitati,
FormTask.Updates
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hello, i test your formula and i modified this line to work, else i have an error of syntax
Patch(
col_Activitati,
If(
FormTask.Mode=FormMode.Edit,
{ID:Gallery1.Selected.ID},
Defaults(FormTask) to Defaults(TaskuriCritice)
),
FormTask.Updates
)
. TaskuriCritice it's the name of SharePoint List where the data is located. Unfortunately when i add a new item it's not show up automatically in the collection -i have a gallery bound to this collection. When i edit an item the modification show up. How can i refresh the collection to show up new items using the formula on submit button?
Hi @ciprianpopovici ,
Try this
Patch(
col_Activitati,
If(
FormTask.Mode=FormMode.Edit,
{ID:Gallery1.Selected.ID},
Defaults(YourListName)
),
FormTask.Updates
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
mmbr1606
275
Super User 2025 Season 1