cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Stop a filtering command

Hi

I have a app where i am doing some ClearCollect(Filter(ForAll( commands and displaying the result in a Gallery. The data comes from a huge SQL database. The problem is when user goes back to previous screen the ClearCollect command stil collecting.  

Is there a way to abort the ClearCollect command when the user klick Back()

8 REPLIES 8
Super User II
Super User II

Where is your ClearCollect function placed? Is it in the OnVisible property of the screen? If so, every time you go back to this screen, it will collect the items again.

So let me know where it is placed and I can help you with it

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

The command for collecting data is placed on the select gallery on previous page.

The user selects from a project gallery that navigates to projectdetail screen. who runs a selected project filtering on documents linked to that project in a gallery.

The problem is that there can be up to 100 documents linked. so if the user clicks the back button the command is stil collecting data. and he have to wait til the dots stops flying in the top of the screen before ha can click a new project..

Navigate(DetaljProsjekt);;
ClearCollect(
    Dokumenter1;
    RenameColumns(
        Filter(
            '[crm7].[APPOINTMENT]';
            Galleryprosjekt.Selected.project_id = project_id
        );
        "document_id";
        "Dokument_id"
    )
);;
Clear(Dokumenter2);;
ForAll(
    Dokumenter1;
    Collect(
        Dokumenter2;
        Filter(
            '[crm7].[DOCUMENT]';
            Dokument_id = document_id
        )
    )
)

 

If I understand it right, you have the ClearCollect in the OnSelect property of the gallery on screen 1. The user clicks on an item in this gallery and the collection process starts, and the user is navigated to screen 2. However, upon arrival on screen 2, the user realises he needs to go back and select another item from screen 1. And your ask is when the user clicks on Back(), how do we stop the current collection process? 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

You got it right.

Did you try adding a Clear(CollectionName) on the OnVisible property of Screen1? 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

Thanks. I wil try tomorrow

Sounds good. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

Sorry. not working. Did what you sugested and put a Clear(Dokumenter1) on OnVisible for screen 1 and list Dokumenter1 gets cleared, but the Forall command stil running. 100 documents =  30sec.

I added a CountRows for both lists on screen 1 to follow.

Other suggestions?Sreens.png

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (4,487)