Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Delegation Help with Indexing

(0) ShareShare
ReportReport
Posted on by 194

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!

Categories:
  • WarrenBelz Profile Picture
    WarrenBelz 145,434 on at
    Re: Delegation Help with Indexing

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard