Greetings all. You usually see me answering, but I thought I would post a question as I just ran into a bizarre situation with the (beloved) ThisRecord operator.
Cut to the chase, This formula (don't worry about the datasource, the limiting conditions, or data):
ForAll(
Filter(Gallery1.AllItems, somelimitingcondition),
UpdateIf(datasource, ID=ThisRecord.ID, {someData})
)
Will end up updating ALL of the records in the datasource. If there are 2 out of 100 records returned by the Filter, all 100 records will be updated. Definitely not expected!!
Interestingly enough, this formula:
ForAll(
Filter(Gallery1.AllItems, somelimitingcondition),
Collect(someCol, ThisRecord.ID);
UpdateIf(datasource, ID=ThisRecord.ID, {someData})
)
Will STILL update all 100 records, but the collection will have 2 ID's in it!!!!
Have I been burned by a new function, or have I been working too hard?
I thought I would throw it out here to the collective to see if anyone else has experienced it. I can reproduce it over and over.
And by the way - thank you to my friend @Gorilla_8 for taking me through a long journey to discover this (especially since I've been using the first formula a lot lately after waiting for ThisRecord for so long.)
Also by the way...I know the solution to resolve the problem as far as not using the ThisRecord operator, but that is not the point here. Looking for anyone else experiencing this before reporting as a Bug!
Thanks @RandyHayes ,
Saved me some grief as this was the next on my list to start exploring and as you have noted, it could produce some nasty results if used on live data.
I will stick to the As statement now as this works great on the Ambiguity issues in a ForAll with the same fields.
Definitely a bug that needs reporting to MS - and soon.
Yes, I thought I would throw it out here on the forum to see if anyone has experienced this and also to serve as a warning for those contemplating using it.
I put together a demo of this using a collection (still same result).
The more I reviewed this and put the demo together the more I started to realize that perhaps this is not so much a bug in ThisRecord and ForAll, but more of an oversight in the documentation!
See the attached app for more details.
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 |
---|---|
166 | |
94 | |
64 | |
63 | |
60 |
User | Count |
---|---|
238 | |
162 | |
95 | |
85 | |
81 |