Hello,
I am trying to create a function that will update a column in a SharePoint list on a button press. The user would enter in a starting date (date picker) and time (made using several combo boxes), and an ending date and time as well as text that would be placed into the SharePoint column. The filter should narrow down any list entries within the start and end date/time and then patch the text into the column for those entries. Anyone know how I could accomplish this?
I am a little unsure of whether the SWITCH function is allowed inside UPDATEIF. Perhaps you can give this code a test inside the OnSelect property of the button. Make sure to change all of the control names to match your own.
UpdateIf(
your_datasource_name,
('Starting Date and Time'
>= Date(DatePicker_Start.SelectedDate)
+ Time(dropDown_startHour, dropDown_startMin)
+ Time(Switch(dropDown_AMPM, "AM", 0, "PM", 12),0,0))
And
('Ending Date and Time'
<= Date(DatePicker_End.SelectedDate)
+ Time(dropDown_endHour, dropDown_endMin)
+ Time(Switch(dropDown_AMPM, "AM", 0, "PM", 12),0,0)),
{yourColumn1: textInput_eventLabel.Text}
)
---
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."
Thanks for looking into this. I'm curious if you can explain to me the reasoning behind choosing UpdateIf over a Filter and Patch. I'm still pretty new to PowerApps, so maybe there is something I don't know. But I thought we had to use Filter and Patch for lists over 2,000 entries, so that the function gets delegated to SharePoint rather than PowerApps not being able to handle processing over 2,000 entries.
I'm very glad to see you are thinking about delgation here and I believe you raise a very good point! I chose to ignore delegation since you had not listed it as a concern.
UpdateIf is only a good option if you have 2,000 records or less since it cannot be delegated. Likewise, the Filter function cannot be delegated when using Dates in the criteria. Its quite a big omission to SharePoint delegation abilities in my opinion. Rumor is there are plans to change that in the future.
I've been meaning to do some experiments on how to overcome this issue but just haven't found the time yet... I believe it could be done by storing dates as a Number data type like this post suggests but that seems like alot of work. (Link: https://powerusers.microsoft.com/t5/Building-Power-Apps/Problems-with-delegation-when-filtering-by-d...).
Link To SharePoint Delegation Summary:
https://powerapps.microsoft.com/en-us/blog/sharepoint-delegation-improvements/
---
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."
User | Count |
---|---|
253 | |
113 | |
92 | |
48 | |
38 |