cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Langemyr
Helper II
Helper II

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
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (61,556)