Search code examples
powerapps

Initial query of data source


Is it possible to set an initial filter for a SharePoint list data source that will be valid for the whole applications? Like, I connect to a "cars" list, but I would like to work only with the "blue" cars.
I know, I can set a filter every time I work with the data source, but I hope there's a simple way to do this in advance.


Solution

  • Currently there isn't a way to apply a global filter for a data source (you can consider creating a new feature request in the PowerApps Ideas board).

    One alternative for this would be to load the filtered data in a collection, and work from that collection instead of the list directly:

    ClearCollect(
        BlueCars,
        Filter(cars, color = "blue"))
    

    If your application mostly queries the list (and the size of the list is small enough for delegation not to be a problem), then it should work. You would need to re-query the list anytime your app makes a change.