Hi, I've got a patch function that updates a single field in some items in the CDS.
Currently, its I'm told it's too slow with about 16 items being patched.
This is the code:
ForAll(
Categories_Gallery.AllItems,
ForAll(Items_Gallery.AllItems,
Patch(
[@Items],
LookUp([@Items], Name = ItemNameLbl.Text),
{
Inspection_result: InspectionResultRadio.Selected.Value
}
);
)
);
The items are inside a gallery, which is inside of a gallery of categories.
It gets every item from its gallery and then patches it. Right now, it takes about 5 seconds to do this and then navigate away from the screen.
Is there any way to make this faster? I was looking at concurrent() to split up the patch but the gallery has a variable amount of categories and items in it, so I don't think that would work.
What is the name of your Primary Key in the CDS table? Is it found in your gallery? If yes, tell me the column name and I can show you how to patch multiple records at once using the 'FAST PATCH' method. Below is a preview of how I do it. Please let me know the answer to my questions and I'll help you out.
Syntax:
Patch(your_datasource_name, your_collection)
Link To Article:
https://matthewdevaney.com/patch-multiple-records-in-power-apps-10x-faster/
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
The primary key for the Categories is item_categoryid and for the items is itemid.
These are not currently used in the galleries, but both primary name fields are.
@Mikkiel
You'll need to include the primary key in your gallery. It doesn't need to be shown as a label. It just needs to be included in the record. Once you have done this let me know.
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Sorry for the late reply, I wasn't able to work on the powerapp until now.
I have included both primary keys in the galleries, I've just added them as labels and hidden them.
User | Count |
---|---|
158 | |
99 | |
83 | |
77 | |
59 |
User | Count |
---|---|
196 | |
173 | |
103 | |
95 | |
89 |