cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MSC01
Helper I
Helper I

ClearCollect only works correctly on second click

Hi, I have built an app the uses clearcollect() - this also includes addColumns which is adding a column based on a custom connector to retrieve distance and duration data from google matrix api.

I have had no issues with small data sets - this being dataverse

However, with large data it seems as though i have to click the button twice for it to retrieve the correct data and display on the gallery with the correct distance and duration otherwise it shows the incorrect data.

4 REPLIES 4
rsaikrishna
Dual Super User
Dual Super User

@MSC01 

 

How large the data you are referring when you are having the issue?

 

Do you see any delegation warning (blue line under the formula)? 

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

There are no delegation warnings. It seems to work correctly when clicking the button again, this is not ideal for users.

@MSC01 

 

When you click the button, set a context variable to disable the button and re-enable the button as soon as the clear function completes.

 

Example:

Button control: btnClearCollection

Button's OnSelect:  UpdateContext({varDisableButton:True});ClearCollect(<your code>);UpdateContext({varDisableButton:False});

Button's DisplayMode: if(varDisableButton, DisplayMode.Disabled,DisplayMode.Edit)

 

I think ClearCollect may be taking sometime to clear out the values. 

 

With above test, we can see if the button is disabled while clearing the collection or not. 

 

Try above approach and post here if you have any comments.

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

 

MSC01
Helper I
Helper I

  • Hi, this would have worked. However I should have mentioned, my collection is based off a initial gallery items, this initial gallery is connected to cds /data verse and is filtered via a combo box. Add columns is then used on the collection which is connected a Google maps api connector to retrieve distance and duration  and the collection is passed to a second gallery. I think what is happening is that, every time the user selects an item from the combo box the first gallery starts to load and retrieve the data to add to the first gallery. When the user then clicks the button for the collection, the first gallery is still retrieving data, hence the collection is not showing data properly. How do I disable the button until the first gallery has finished retrieving data. 

Helpful resources

Announcements
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.

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

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 (2,541)