Hi
I have a galery with checkboxes. I want to select multiple items and patch create records based on galery values and on additional textbox values into specific dataverse table(not the table from where i get some info in galery)
these also include some lookup fields
What is the best approach of doing it?
Solved! Go to Solution.
Please provide any formulas that you are trying and have errors and identify what is in error.
So then, I missed one word in your original post - "create"
You DO NOT want to update records that are checked in the Gallery, you want to create new records in another table.
If that is the case, then change the formula I provided to the following:
Patch(yourDataSource,
ForAll(Filter(yourGallery.AllItems, yourCheckbox.Value),
{
column1: column1Value,
etc
}
)
)
Or in other words...drop the primary key column! If patch does NOT see a primary key in the records you provide it, then it will create them. Be aware, you need to provide any required column values if you have any.
Your formula would be similar to the following:
Patch(yourDataSource,
ForAll(Filter(yourGallery.AllItems, yourCheckbox.Value),
{ID: ID,
column1: column1Value,
etc
}
)
)
You need to provide the primary key! In the above ID is used as the primary key (i.e. SharePoint), so for Dataverse, determine what your primary key is and replace the two ID's in the above.
I hope this is helpful for you.
I would recommend using a ForAll function...
Maybe, first create a collection for the itens for each table and after that do the patch
You check if the collection has data. If yes, ForAll() and Patch
If not, nothing.
ForAll -
https://docs.microsoft.com/en-US/powerapps/maker/canvas-apps/functions/function-forall
Patch-
https://docs.microsoft.com/en-US/powerapps/maker/canvas-apps/functions/function-patch
If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!
Best regards,
Gonçalo Nogueira
Check my LinkedIn!
Check my User Group (pt-PT)!
Last Post on Community
My website!
No need to duplicate the data yet again in the app into a collection - the Gallery already contains all of the data needed. Utilize the formula I provided to achieve the desired results.
You are correct @RandyHayes . I thought that he wanted to create multiple data in defferent tables.
Sorry @jja , just use ForAll() and Patch
No worries - but even so, a collection is only needed when you need the ability to have an in-memory database with add/remove/edit capabilities. For a Patch or ForAll or anything else that needs a table...well, all you need is a table! AllItems is a Table 😁
@RandyHayes my only idea on the collections was for separate the tables, it would be easier (in my opinion), after that they would be deleted. Since it only needs 1 table, you are completily right, a collection would only complicate and maybr put the app slower
Hi @RandyHayes in this table my primary name columns is Autonumber
How do i handle it in patch?
The Name of your column is Autonumber?? Or that is the type?
What you need to do is to look at your table definition in dataverse and verify what the primary key is - it will be annotated as the primary key. THEN you need to replace the ID (both of them) in the formula with the actual name of the column. And to be clear - it is the Column Name that you want to put int, NOT the Display name.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
190 | |
63 | |
44 | |
34 | |
25 |
User | Count |
---|---|
243 | |
106 | |
89 | |
84 | |
64 |