Lazy loading of items from SharePoint instead of Eager loading to avoid delegation warning

530 views Asked by At

I have 2 SharePoint lists:-

  1. Task list .. with these fields:-
  • ID

  • Title

  1. PeopleWork list.. with these fields:-
  • ID

  • TaskID .. This should store the Task ID from the Task list in numeric format

  • Single selection people/group field named People

So now i tried to create a demo gallery inside my Power Apps canvas which should only show the Tasks where the user is assigned to. so on the Screen OnVisible i build this collection to get the PeopleWork items which have the login user email:-

ClearCollect(relatedtasks,Filter(PeopleWork,People.Email=User().Email)) 

then on the Items property of the gallery i define this formula:-

enter image description here

but i also got a delegation warning..is there a way to fix this? Can i instead of eager loading the Tasks items using this formula:-

filter(task,ID in relatedtasks.TaskID)

which will retrieve the related Tasks items in one call, to Loop through the relatedtasks collection and for each TaskID issue a separate Lookup to get the related Task and build a collection of all the Tasks which have their Ids inside the relatedtaks.TaskID collection? so i can get all the related Tasks item without getting an delegation warning?

Thanks

1

There are 1 answers

8
Iona Varga On

Don’t collect the records, PowerApps can display all records, just not collect them.

You can use

Filter( PeopleWork, User().Email = useremailcolumn)

On your gallery, you can add a textfield of value:

First( Filter( Task, Id = ThisItem.TaskId)).Title

Now you have all records related to the logged in user and the task names ;-)