I am working on an offline scenario in an app to be run from a tablet. If connected, I load a collection of rows that can be updated offline and then synched to the DB once back online.
I create a collection as;
ClearCollect(colMembers, Filter('[dbo].[Members], IsActive = true))
then when one of the rows is selected for edit, I update controls on a screen with their current value to be edited. When saving (clicking the save button) I issue a patch command.
Patch(colMembers, First(Filter(colMembers, MemberId = varSelectedMemberId)), {FirstName: txtFirstName.Text, LastModified: Now()})
I've paired this down for clarity, but the FirstName updates fine, but LastModified will only update if it previously had a value. I find this quite odd as I don't have this issue patching Azure DB tables directly, only a local in-memory collection. I checked other columns and all will update if they previously had a value, any rows where a column is blank, simply refuses to update. I have to keep all changes in this collection, that saves to local device data store using SaveData() so that I can synched once back online.
I would consider this a bug. Has anyone else run across this?
I saw somewhere that UpdateIf might work, while it's a workaround, this is still not right.
Thanks!
Solved! Go to Solution.
Yes, this is a long standing bug with the Patch function with blank columns and collections.
Use the UpdateIf function. It works 100% of the time.
I hope this is helpful for you.
Yes, this is a long standing bug with the Patch function with blank columns and collections.
Use the UpdateIf function. It works 100% of the time.
I hope this is helpful for you.
That's interesting. Do you know if this is only related to Azure DBs or does it also affect SharePoint Lists?
Reason I ask is because I have almost this exact same build design going on as @mike528 (thought he may have hacked my Environment for a moment, lol) except I'm using SharePoint so wanting to get ahead of any issues early, if possible.
Sounds like it's a bug (Microsoft, you listening!!! 😀), UpdateIf() fixed my issue completely and an easy switch.
Thanks!
Yep...SharePoint too!
I ran into it enough that I just got used to UpdateIf for everything. And, it's an easy transition.
Thanks for getting back to me. Looks like I will also be making the transition 🙂
The good news is that it's an easy switch. Very thankful to @RandyHayes , otherwise I might have been bailing on my Offline capability design.
I just came across this issue too. Wasted three hours fiddling with it. I end up filling the column with a "-".
An example of UpdateIf would be helpful 😁
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
207 | |
97 | |
60 | |
53 | |
51 |
User | Count |
---|---|
255 | |
158 | |
87 | |
79 | |
65 |