cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Langemyr
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
Super User

Re: Stop a filtering command

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)
Langemyr
Frequent Visitor

Re: Stop a filtering command

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
        )
    )
)

 

Highlighted
Super User
Super User

Re: Stop a filtering command

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)

Langemyr
Frequent Visitor

Re: Stop a filtering command

You got it right.
Super User
Super User

Re: Stop a filtering command

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)

Langemyr
Frequent Visitor

Re: Stop a filtering command

Thanks. I wil try tomorrow
Super User
Super User

Re: Stop a filtering command

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)

Langemyr
Frequent Visitor

Re: Stop a filtering command

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (6,693)