Hi all,
In the OnVisible property of a PowerApp screen (MyCourses Screen), I have this code:
Refresh(Registrations); ClearCollect(colMyCourses, Filter( Registrations, Employee.Email = varUser.mail, Priority <> 0, Course.Id in varVisibleCourses.ID) )
Registrations - a list in SharePoint
Employee - a Person field in that list
Priority - a Number field in that list
Course - a Lookup field in that list, looking on a different SharePoint list (Courses)
varUser - a global variable in PowerApps
varVisibleCourses - a global variable in PowerApps, which contains a subset from Courses SP list
In another screen of the app, I add an item to the Registrations SP list, and with the OnSuccess property of the form, I navigate to MyCourses Screen, expecting to see the newly added course. And I Do!
But, since the last part of the filter (Course.Id in varVisibleCourses.ID) gives a delegation warning (about the in operator), I decided to delete this part of the filter, so I'm left with a fully delegated filter:
Refresh(Registrations); ClearCollect(colMyCourses, Filter( Registrations, Employee.Email = varUser.mail, Priority <> 0) )
Now I don't get any delegation warning, but strangely - now, after adding a course, the OnSuccess property navigates to MyCourses Screen, but the new course is not there. When I check the collection, it does not contain the new course... Only if I manually navigate away of this screen, and then navigates back to the MyCourses screen - only then, on the 2nd visit to the page, I will see the changes in the list (my new course).
Any idea why this is the behavior I'm seeing?
Thanks
Gil.
If delegation is implemented then Refresh(Registrations) is not required since it will always delegate to the underlying data source to fetch the data
Employee.Email = varUser.mail, Priority <> 0,
These also should give you delegation warnings
Please check the app checker to ensure there are truly no delegation warnings
Regards,
Reza Dorrani
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thank you @RezaDorrani for taking the time to read and respond.
My current code (the first snippet) does include the delegation warning, that is why I still need to Refresh(Registrations). If I can solve the problem with the collect function that does not return the most updated data, I would be happy to take off the non-delegated part and therefore also remove Refresh(Registrations).
Both of these -
Employee.Email = varUser.mail, Priority <> 0,
do not raise delegation warnings, the app checker is clean of errors.
I was surprised by the Employee.Email part as well.
The <> operator suppose to and does work - even by documentation for SharePoint connector.
Thanks again,
Gil.
Emmployee person type column is a complex type column in PowerApps and unfortunately is not delegable
Regards,
Reza Dorrani
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @RezaDorrani ,
Even though they were no delegation errors, I have changed the code to:
ClearCollect(colMyCourses, Filter( Registrations, Email = varUser.mail, Priority <> 0) )
(where Email is a Single Line of Text field, which also contains the Email address of the user)
Nevertheless, when I navigate to this page I still don't see the new course right ahead, but only after navigating away and back to the screen.
Hi @shalem120kjh ,
I think this is mainly about the delay of updating data.
When you first navigate to this screen , the new data has not transferred to PowerApps.
I suggest you add a Timer control to add some time to update data.
For example:
Set the Timer's Duration: 10
Set the Timer's OnTimerStart: Refresh(datasource)
Set the Timer's OnTimerEnd : Navigate(Screen..,....)
Then, before you naviage to this screen, it will refresh the data source and wait for some moments.
Here's a doc about Timer for your reference:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-timer
Best regards,
Community Support Team _ Phoebe Liu
Hi @v-yutliu-msft ,
I will give it a try later, but even if it works, do you have an idea how comes when this line of code is included in the filter - the update happens immediately, and when I remove it, the update is delayed?
Course.Id in varVisibleCourses.ID
Thanks,
Gil.
User | Count |
---|---|
180 | |
119 | |
87 | |
44 | |
41 |
User | Count |
---|---|
246 | |
156 | |
127 | |
77 | |
73 |