cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Langemyr
Level: Powered On

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
PowerAddict
Level 10

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
Level: Powered On

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

 

PowerAddict
Level 10

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
Level: Powered On

Re: Stop a filtering command

You got it right.
PowerAddict
Level 10

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
Level: Powered On

Re: Stop a filtering command

Thanks. I wil try tomorrow
PowerAddict
Level 10

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
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,221)