cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JR-BejeweledOne
Super User
Super User

Filtering on date Help

I have a Teams Power app using dataverse.   The table name field is a text date as this is the key for this app.  

 

On selecting 'edit mode' and choosing a team, a collection is populated with all the entries for that team, past and future.    I need to be able to filter this further by not pulling in any dates prior to today.

 

I currently have this which is working now but has delegation errors

 

ClearCollect(colEditSchedule,
        AddColumns(Filter(OnCallSchedules, cr9f7_team = DropdownTeam.Selected.Name && DateValue(Name) >= Today()),"IsChosen", false))

 

JRBejeweledOne_0-1641486507657.png

 

Since this has the potential to grow quite large, I would like to avoid the delegation errors.

 

Any suggestions for how to do that here?

:

 

 

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@JR-BejeweledOne 

You're not going to be able to delegate that criteria because you are performing a PowerApp function on each record to support the criteria.  There is no way that PowerApps can delegate that to the source.

 

Consider the following formula instead:

ClearCollect(colEditSchedule,
    With({_items: Filter(OnCallSchedules, cr9f7_team = DropdownTeam.Selected.Name)},

        AddColumns(
            Filter(_items,
                 DateValue(Name) >= Today()
            ),
            "IsChosen", false
        )
    )
)

This will perform the non-delegable criteria on in-memory records returned from the first Filter statement.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

8 REPLIES 8
RandyHayes
Super User
Super User

@JR-BejeweledOne 

You're not going to be able to delegate that criteria because you are performing a PowerApp function on each record to support the criteria.  There is no way that PowerApps can delegate that to the source.

 

Consider the following formula instead:

ClearCollect(colEditSchedule,
    With({_items: Filter(OnCallSchedules, cr9f7_team = DropdownTeam.Selected.Name)},

        AddColumns(
            Filter(_items,
                 DateValue(Name) >= Today()
            ),
            "IsChosen", false
        )
    )
)

This will perform the non-delegable criteria on in-memory records returned from the first Filter statement.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

With the formula you provided am I going to have to write this to manually bring in each column that I need?   

 

With the current formula:

 

FilteredCollection.jpg

 

With your formula as is:

 

FilteredCollection1.jpg



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
RandyHayes
Super User
Super User

@JR-BejeweledOne 

Turn the Explicit column selection feature off in your app settings.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

That doesn't seem to be an option for a Teams Power App.   My fault for not providing enough information.  This is a Teams Power app and the data is coming from a Dataverse table.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
RandyHayes
Super User
Super User

@JR-BejeweledOne 

Ah, the devil is in the details!! 😈

 

Yes, that option is not available in Teams.  

The image you showed is the classic example of the feature I mentioned.  When it is on, PowerApps will only pull data for the columns that are used.  

I am not seeing in your picture though...is the cr9f7_team column getting populated or just the cr9f7_name?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

There are 17 columns in that table that are used in the gallery and populated by the various controls.

 

Here is a different view  of the collection after using the formula provided 'as-is'.    I included a subset of columns from the table here.

coleditschedule.jpg



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
RandyHayes
Super User
Super User

@JR-BejeweledOne 

So the answer then is "yes", only the team and name columns are coming in.  

I asked that specifically because this is mimicking the exact thing that is seen when that feature I mentioned is on. 

The formula I provided specifically uses Name and Team...so, that is all that PowerApps thinks it needs and thus only retrieves them.

To resolve that (in a normal app), one would turn off that feature mentioned. 

What is odd is that your original formula DID get the column values - that formula is where you would see the missing information in a normal app.

 

So, I am not sure where to go from there.  It almost seems like there is a setting somewhere to control this.  As I don't work in the PowerApps Teams and Dataverse world that much, it is not my strong point.  But, the understanding of what it is doing is clear.  And, if I had a few bucks to bet, I'd say this is a bug (the lack of not being able to control that option).

 

I would have to do some trials to see if I can reproduce the results and what would be the workaround.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

I don't know what is going on.   I have been having strange issues with Teams for about 2 weeks now.   Could be something going on in our environment, who knows.  

 

I left it over the weekend and it seems to be working correctly now.    All of the columns are being populated.

 

Happy New Year to me! 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (5,054)