Hello,
Im struggling to work out a solution to patch all items in a filtered gallery.
this is what i use to patch a single record
Patch(studenttrackermaster2,ThisItem,{Comments:TextInput1_2.Text},{maths_WorkCompletion:Dropdown2_2.SelectedText},{maths_engagement:Dropdown2_8.SelectedText})
I have attached an image for example
my unique field for each = "UPN"
Solved! Go to Solution.
Hi @marc2510 ,
After our discussion and your renamed controls
ForAll(
RenameColumns(
Gallery1.AllItems,
"ID",
"ID1"
),
Patch(
studenttrackermaster2,
{ID: ID1},
{Comments: TextComments.Text},
{Art_WorkCompletion: {Value: ddCompletion.Selected.Value}},
{Art_engagement: {Value: ddEngagment.Selected.Value}}
)
)
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.
Hi @marc2510 ,
This structure will do it
ForAll(
Filter(
YourGalleryName.AllItems,
YourFilterHere
) As aFiltered,
Patch(
studenttrackermaster2,
{UPN:aFiltered.UPN},
{
Comments:TextInput1_2.Text,
maths_WorkCompletion:Dropdown2_2.Selected.xxx,
maths_engagement:Dropdown2_8.Selected.xxx
}
)
)
Note xxx is whatever the .Selected. value is for the control (Value/Result/Field Name)
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.
Thank you for the swift reply!
currently the gallery is filter like so Filter(studenttrackermaster2,Maths.Value=Dropdown1_2.Selected.Value)
how would i add this for the gallery filter?
No need to if your gallery is already filtered - I assumed you wanted to add a filter to it
ForAll(
YourGalleryName.AllItems As aFiltered,
Patch(
studenttrackermaster2,
{UPN:aFiltered.UPN},
{
Comments:TextInput1_2.Text,
maths_WorkCompletion:Dropdown2_2.Selected.xxx,
maths_engagement:Dropdown2_8.Selected.xxx
}
)
)
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.
To get rid of the error, I added Gallery1_1.Allitems
ForAll(
Gallery1_1.AllItems As aFiltered,
Patch(
studenttrackermaster2,
{UPN: aFiltered.UPN},
{
Comments: TextInput1_1.Text,
Eng_WorkCompletion: Dropdown2_1.SelectedText,
Eng_engagement: Dropdown2_7.SelectedText
}
)
)
but this then makes changes to all items on the list
I was using your values here as you posted that UPN was the common key between the tables. What type of field is UPN?
UPN is the unique value given to each user (like an ID)
UPN is just a text field.
I’m very grateful for all the support on this
I have fixed the AllItems - dangers of free-typing.
Why are you getting the error that UPN was expecting a Table?
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.
@WarrenBelz The error has now gone when using the all items.
When i am using the ForAll function it is saving all the records the same instead of treating each row of data individually?
for example if i add a comment to the user with UPN 681 - it then changes all the other users comments to the same. I want it to save each row individually
User | Count |
---|---|
254 | |
246 | |
82 | |
44 | |
27 |
User | Count |
---|---|
341 | |
268 | |
123 | |
61 | |
58 |