Hello,
Having Issues Patching existing records in SharePoint.
I have a gallery named: ExcelGallery
Items: SortByColumns(Filter(Gateways, MasterID = ProgramGallery.Selected.ID),"Date")
Have a hidden toggle to detect changes
Defaults:
ThisItem.'Year' <> YearInput.Text ||
ThisItem.'Field' <> FieldInput.Text ||
Patch Formula:
ForAll(Filter(ExcelGallery.AllItems, Toggle1.Value = true),
Patch(Gateways, ThisRecord, {'Year': YearInput.Text}));
Navigate(Home)
Saving to SharePoint and Currently Title field is not being used/required.
Don't know why data is not getting updated. Is there an issue with using ThisRecord?
Thanks in advance.
Solved! Go to Solution.
Ah, it makes a difference if controls such as VPPDateInput are located within the gallery. In that case, try revising your code as shown to capture the separate values in each gallery item:
ForAll(
Filter(ExcelGallery.AllItems, Toggle1.Value = true) As aRecord,
Patch(Gateways, aRecord,
{
ModelYear: MYInput.Text,
Program: ProgramInput.Text,
Ref_Only_Drop: {Value: RefOnlyInput.Selected.Value},
VPPDate: aRecord.VPPDateInput.SelectedDate
})
);
You may also want to similarly edit the control references for MYInput, ProgramInput, and RefOnlyInput if those are also located within the gallery.
Bryan
A ForAll()-Patch() combination needs an As operator to help resolve ambiguity:
ForAll(Filter(ExcelGallery.AllItems, Toggle1.Value = true) As aRecord,
Patch(Gateways, aRecord, {'Year': YearInput.Text}));
Navigate(Home)
Hope that helps,
Bryan
@BCLS776 Thanks Bryan. Wish I could buy you a cold beverage or send a tip. Thanks.
@BCLS776 This patch seems to be treat different lines of data as the same. If I make multiple date
ForAll(Filter(ExcelGallery.AllItems, Toggle1.Value = true) As aRecord,
Patch(Gateways, aRecord, {ModelYear: MYInput.Text,
Program: ProgramInput.Text,
Ref_Only_Drop: {Value: RefOnlyInput.Selected.Value},
VPPDate: VPPDateInput.SelectedDate}));
Navigate(Home);
Refresh(Gateways)
Before:
Change Dates to 28, 29, and 30. Saves all three dates as 30. Any advice on how to avoid this situation?
Ah, it makes a difference if controls such as VPPDateInput are located within the gallery. In that case, try revising your code as shown to capture the separate values in each gallery item:
ForAll(
Filter(ExcelGallery.AllItems, Toggle1.Value = true) As aRecord,
Patch(Gateways, aRecord,
{
ModelYear: MYInput.Text,
Program: ProgramInput.Text,
Ref_Only_Drop: {Value: RefOnlyInput.Selected.Value},
VPPDate: aRecord.VPPDateInput.SelectedDate
})
);
You may also want to similarly edit the control references for MYInput, ProgramInput, and RefOnlyInput if those are also located within the gallery.
Bryan
That worked. Thank you.
ForAll(Filter(ExcelGallery.AllItems, Toggle1.Value = true) As aRecord,
Patch(Gateways, aRecord, {'Model Year': aRecord.MYInput.Text,
Program: aRecord.ProgramInput.Text,
Reference_Only: {Value: RefOnlyInput.Selected.Value},
'VPP Dates': aRecord.VPPDateInput.SelectedDate}));
Navigate(Home);
Refresh(Gateways)
User | Count |
---|---|
157 | |
93 | |
78 | |
73 | |
57 |
User | Count |
---|---|
202 | |
166 | |
98 | |
94 | |
79 |