cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Future_Vision
Post Patron
Post Patron

How do you leverage the Dataverse(CDS) Owner data type for filtering?

I want to be able to filter a gallery. I was thinking that I can compare the User().FullName to the Owner value in my table. It appears that Owner is a default column in all of my dataverse(CDS) tables with an Owner data type.  When I true and use Owner the comparison becomes non-delegable and I get this error 'Expected text. We expect text at this point in the formula'.

 

Can I use the Owner column for what I am trying to do? Do I need to write the User().FullName to my Dataverse table with each new record added and use that instead?

6 REPLIES 6
ChrisPiasecki
Super User
Super User

Hi @Future_Vision,

 

The Owner type is polymorphic in that it can be either a User or a Team. You need to use the AsType function to cast it as a User and compare the 'Full Name'. Something else to consider,  the Office 365 full name could have middle name whereas Dataverse does not include the middle name, so you might have issues comparing on full name. A safer comparison is to use Email instead. Try either of the examples below (I'm using the Account table to substitute your table name).

 

Remember to include the Users table as a data source in your canvas app in order for the filter to work.

 

Comparing Full Names:

Filter(Accounts, AsType(Owner, Users).'Full Name' = User().FullName)

Comparing Emails:

Filter(Accounts, AsType(Owner, Users).'Primary Email' = User().Email)

 

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

Future_Vision
Post Patron
Post Patron

@ChrisPiasecki 
"Remember to include the Users table as a data source in your canvas app in order for the filter to work"

 

Would this be the ApplicationUsers Dataverse table in PowerApps for Teams?

ChrisPiasecki
Super User
Super User

Hi @Future_Vision,

 

In both Dataverse and Dataverse for Teams its called Users

 

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

@ChrisPiasecki 
Doh! I already have it added as a data source. No wonder I couldn't add it.

Future_Vision
Post Patron
Post Patron

Future_Vision_0-1619109861054.png

 

Ok. So now I'm trying to get this to work without much luck. Above is what my filter selections look like. Here is what I am trying to do.

  1. The default for the gallery is that it only shows the users results.
  2. If they check the 'See All Records' box it shows everything
  3. The can use the 'Campaign Owner' to narrow down the gallery results by owner's name

I've tried working with an IF statement which hasn't been successful to filter the list based on the checkbox.

I can get the Campaign owner filed working but it is not delegable which I would like it to be.

 

Suggestions?

Future_Vision
Post Patron
Post Patron

I'm wondering if it just makes more sense to write the User().Email and User().FullName to the table when they submit a form instead of playing around with the Owner column. I realize I'll have duplicate information but it might be easier to deal with. Thoughts?

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (44,577)