cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Owizardo
Helper III
Helper III

How to detect errors on a ClearCollect?

Hello,

I have a simple application where I allow users to subscribe to a newsletter. Upon first load of the application I check my Sharepoint list to see if the user's email already exists if not, I force navigate to a welcome screen with instruction to register for first time.

Sharepoint list:

===================
User_list (Sharepoint)
===================
Email (text column)
===================
bob@email.com
-----------------------
rob@email.com
-----------------------
tobby@email.com
------------------------

 

ClearCollect(User_Info, Filter(User_list, Email = Text(User().Email) ))

If( IsEmpty(User_Info), Navigate(New_User_Screen, Cover), Navigate(Existing_User_Screen, Cover) )

I have everything working except for one bug i found, lets say the user lost his network (No wifi or LTE). If they open the application without a network connection, they get forced to the New_USer_Screen even if they do have an account. I was expecting powerapps to generate a generic message for users but it does not ...

 

Is there a way to detect errors during the ClearCollect process and force user to an error screen? 

1 ACCEPTED SOLUTION

Accepted Solutions

You can avoid the overhead by modifying your condition as following: 

If( IsEmpty(User_Info) And CountRows(User_list) > 0...

In this case, if the User_Info is not empty then the CountRows will not be called and therefore there should not be any overheads.

View solution in original post

3 REPLIES 3
dinusc
Microsoft
Microsoft

Hello @Owizardo,

Have you tried checking the source list (User_list) to ensure it has data? Something like If(CountRows(User_list) > 0 , HandleConnectionPresent, HandleEmptyList)

Are you suggesting that I CountRows on my list so that it ensures there is a successful connexion before proceeding with my validations?

While i like this idea, it would in a way simulate a onsuccess method i can hook to. But if I have a list of 1000 records, wouldnt that add to the delay to read it twice?

You can avoid the overhead by modifying your condition as following: 

If( IsEmpty(User_Info) And CountRows(User_list) > 0...

In this case, if the User_Info is not empty then the CountRows will not be called and therefore there should not be any overheads.

View solution in original post

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (3,830)