cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Optimisation - unexpected behaviour with Collect

Just sharing an observation and suggestion for a change in the behaviour of the Collect statement.

 

In my app I have a number of Collect statements of the following form:

  Collect(
            '[ChemRec].[Recommendation]',
            Filter(
                colMyRecommendation,
                IsBlank(ID)
            )
        )

Where the filter returns no records, I would expect the Collect statement to effectively be ignored - to simply not run at all rather than run by saying 'Add 0 rows to the collection' and initiate communication to the datasource.

When stringing a few of these commands together, peformance took a realy hit. Ten such collections took over a minute to run when there was no data returned by the filters (some Collect statements were run with Concurrent but others are ineterdependent so must run sequentially).

By wrapping all the Collect statements within If statements that first check the local collection to see if it actually contains entries (as shown below) peformance increased dramatically and the same set of commands take around a second to run.

    If(
        CountRows(
            Filter(
                colMyRecommendation,
                IsBlank(ID)
            )
        ) > 0,
        Collect(
            '[ChemRec].[Recommendation]',
            Filter(
                colMyRecommendation,
                IsBlank(ID)
            )
        )
    );
1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff SpencerLynn
PowerApps Staff

Re: Optimisation - unexpected behaviour with Collect

Hi!

Thank you for the feedback! I have shared your feedback with the engineering team for further consideration.

Thanks!

2 REPLIES 2
PowerApps Staff SpencerLynn
PowerApps Staff

Re: Optimisation - unexpected behaviour with Collect

Hi!

Thank you for the feedback! I have shared your feedback with the engineering team for further consideration.

Thanks!

Administrator
Administrator

Re: Optimisation - unexpected behaviour with Collect

Thanks for the helpful post @PaulD1 !

 

@TopShelf-MSFT 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 56 members 4,601 guests
Please welcome our newest community members: