Hi All,
So i'm pretty familiar with the delegation warning in power apps as I had to learn how to fix some of my patch filtering, but this one is completely at a loss for me and I'm hoping someone out there can help me.
I have a scan barcode function that a user can scan tag number and serial number in that order on an item before moving onto the next. The code looks like this to patch:
ForAll(Sequence(CountRows(tags) / 2),
If(IsEmpty(Filter(Inv_Equipment, AssetTag = Index(tags, Value * 2 - 1).Value)),
Patch(Inv_Equipment, Defaults(Inv_Equipment), {
AssetTag: Trim(Index(tags, Value * 2 - 1).Value),
SerialNumber: Trim(Index(tags, Value * 2).Value),
}, ReceiveForm_1.Updates)))
The line of code where it says AssetTag = Index(tags, Value * 2 - 1).Value)) has a delegation warning and it is causing issues now that our data is more than 2k records (it's actually 34k records after migrating).
The spec needed is the first scanned number is the tag, second is the serial and I need to save it in the respective column, the issue is the filtering before patching, I don't want duplicate records in my database so I need to check that the first tag (asset tag) does not exist. Anyone know how to resolve this delegation warning while keeping the spec? Thank you so much!
Hi @Nicci ,
I may not have the logic totally correct, but you should get the idea here to take the calculation out of the Filter.
ForAll(
Sequence(CountRows(tags) / 2),
With(
{
_Tag: Index(tags, Value * 2 - 1).Value
_Serial: Trim(Index(tags, Value * 2).Value)
},
If(
IsEmpty(
Filter(
Inv_Equipment,
AssetTag = _Tag
)
),
Patch(
Inv_Equipment,
Defaults(Inv_Equipment),
{
AssetTag: Trim(_Tag),
SerialNumber: _Serial
},
ReceiveForm_1.Updates
)
)
)
)
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.
MVP (Business Applications) Visit my blog Practical Power Apps