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

Dataverse Views - Can I Use a Variable From My Canvas App and Send to the 'Filter By' In My View?

I am building a canvas app with a Dataverse data source.  I have a gallery where the Items property is set to a Dataverse view which has a filter and it works as expected.  

// This code works in the ITEMS property of my gallery
Filter( AssignedUserss, 'AssignedUserss (Views)'.'DIApp Home User Dashboard' )

 But the filter in my Dataverse view uses a hard-coded email and I need it to be the logged in user (i.e., User().Email).  Can I pass a canvas app variable to the filter in the DV view to replace the hard-coded email value?    
Dataverse - DI App HM User Dashboard View - FILTER.png
If that is not possible, then can I remove this filter from this DV view and perform the additional filter in the ITEMS property of my gallery (i.e., modify the gallery ITEMS formula in the code snippet shown above)?  This is a new concept for me so I appreciate any suggestions.  

1 ACCEPTED SOLUTION

Accepted Solutions
dpoggemann
Super User
Super User

Hi @cmanning ,

 

Right, this is not possible to add as a dynamic parameter on the view.  You might want to look at adding a search on to your filter, something like this:

Search(Filter('AssignedUserss', 'AssignedUserss (Views)'.'DIApp Home User Dashboard'),emailtosearch.Text,"solutionprefix_assigned_email")

where you would have the field for the email you are trying to search for (probably the User().Email or something like that) and then the name of the column from the Dataverse table in the double quotes. 

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew

View solution in original post

5 REPLIES 5
365-Assist
Power Participant
Power Participant

Good question . There doesn't seem to be an out of the box answer. In fact someone has posted it as an Idea. Give it a Vote. Make CDS Views accept parameters - Power Platform Community (microsoft.com)

 

A work around could be to create lookup column using the User Table

365Assist_0-1655274782633.png

Then just create a filter based on that column

365Assist_1-1655274836427.png

 

---------------------------------------------------
Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful as can help others.

Subscribe: https://www.youtube.com/channel/UCFpvUlpx84FuIPOdInGKMTw
Twitter: https://twitter.com/assist_365

Regards
Darren Lutchner - 365 Assist

dpoggemann
Super User
Super User

Hi @cmanning ,

 

Right, this is not possible to add as a dynamic parameter on the view.  You might want to look at adding a search on to your filter, something like this:

Search(Filter('AssignedUserss', 'AssignedUserss (Views)'.'DIApp Home User Dashboard'),emailtosearch.Text,"solutionprefix_assigned_email")

where you would have the field for the email you are trying to search for (probably the User().Email or something like that) and then the name of the column from the Dataverse table in the double quotes. 

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew

@dpoggemann - Thank you for the solution!  Below is the working code.  I'm glad to know what I initially wanted to do (pass a variable to a DV view) is not possible until MS decides to make that feature available. 

Search( Filter( AssignedUserss, 'AssignedUserss (Views)'.'DIApp Home User Dashboard' ), User().Email, "cr4de_assignedemail" )

 

@365-Assist - Thank you for your response and for providing the link to the feature request (I upvoted it)!

DaveBraben
Regular Visitor

I can't believe this requirement hasn't got a high profile with concerns around delegation. I can only suggest the use of startswith() as this is delegable. However, it requires a string value. There's a lot of hacky code out there where users are creating string fields and then extracting a string from their required filter value and then using an automated Power Automate to then save it as a string.

Helpful resources

Announcements
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.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,926)