cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
barlowse
Advocate IV
Advocate IV

Add the ability to CDS Views - to filter by a parameter

Being able to use Views defined on the CDS entities is great for Power Apps, however, you still have to fetch all your rows and use filtering within the app to limit the data presented to the user. I would like to be able to pass a parameter to the CDS view in order to limit the rows fetched from the server.

2 ACCEPTED SOLUTIONS

Accepted Solutions
EricRegnier
Super User II
Super User II

Hi @barlowse, thanks for clarifying. Since you're using canvas apps, options are:

  1. custom views but since you have lots of values it doesn't scale well like you mentioned
  2. apply the filtering directly in you canvas app with the filter expression, but you'll need to find a way to determine what that value (i.e. "Record 1") is. Would it be possible determine in the app and store value in a variable to reference in the other places?

View solution in original post

barlowse
Advocate IV
Advocate IV

Filtering is what used with the views, so its working. Also I added an Idea here https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Make-CDS-Views-accept-parameters/idi-p/525667

for consideration.

View solution in original post

9 REPLIES 9
SeanHenderson
Impactful Individual
Impactful Individual

You can customize your view to filter down to specific records. The filter is found in the bottom right of the view creator. 

 

Annotation 2019-12-16 105547.png

 

---
Please hit the "Accept as Solution" button if my post answered your question! If my post was helpful please consider giving it a "Thumbs Up."

Yes - the filtering is available - but it is a static filter - I am looking for a dynamic filter - where I can pass a variable from a Pwer App to the View.

Somebody, I need to same. I need to have the possibility to add a variable name. So that I can pass a value from the powerapps selection to the view. Thanks  

gdavenport
Advocate I
Advocate I

This feature would be extremely helpful

Hi @barlowse,

It is not possible out-of-the-box to have a dynamics filter in the entity list page (clicking the entity from the sitemap). For what exact scenario are you trying to have a dynamics filter? There are probably a few workarounds, for instance:

  • If you want to dynamics filter a view for a lookup field that it's possible with the addCustomFilter function

 

formContext.getControl(arg).addCustomFilter(filter, entityLogicaName)

 

  • For a subgrid on a form, then you can dynamics filter based on the related record
  • Or you can filter a subgrid on a form with SetParameter but it is an unsupported customization
  • You can have some pre-build views and toggle them as need be

Hope this helps

 

 

barlowse
Advocate IV
Advocate IV

Thanks for the reply Eric. I am building canvas apps on custom cds tables.
I guess to put it simply, I am looking for something like a stored procedure in SQL that I can pass a variable piece of data to and have the server do all of the filtering. Using custom views on the cds table will only get me so far, because it has to be a known value. The best workaround I have been able to do is, to use a static field that I populate with a value for example "Record 1", and then build my view using this field in the filter. However if this field has hundreds of different values - I have to build that many custom views. Which is not ideal. 
Power Automate could preform the feat for me, but I have not had positive experiences using a flow in a canvas app and the time it takes to return results has not been less than acceptable.

EricRegnier
Super User II
Super User II

Hi @barlowse, thanks for clarifying. Since you're using canvas apps, options are:

  1. custom views but since you have lots of values it doesn't scale well like you mentioned
  2. apply the filtering directly in you canvas app with the filter expression, but you'll need to find a way to determine what that value (i.e. "Record 1") is. Would it be possible determine in the app and store value in a variable to reference in the other places?

View solution in original post

Fubar
Solution Sage
Solution Sage

Think Filter is the only method provided.

 

Filter('Contacts', _accountid_value = GUID("record_guid"))

barlowse
Advocate IV
Advocate IV

Filtering is what used with the views, so its working. Also I added an Idea here https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Make-CDS-Views-accept-parameters/idi-p/525667

for consideration.

View solution in original post

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (2,716)