cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Filter formula

I need to make a filter so that only the current user can see their approval requests

 

Captura de Pantalla 2019-08-18 a la(s) 12.31.05.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Filter formula

Hi @octaking ,

Where do you put your formula? Within Gallery Items property?

 

If you put your formula within the Gallery Items property, please modify your formla as below (set the Items property of the Gallery to following formula😞

Filter(
AddColumns(Approvals; "OwnerName", AsType(Owner, Users).'Full Name'); /* <-- Modify formula here. Type Owner rather than ThisItem.Owner */
Status = 'Status (Approvals)'.Inactive; /* <-- If you want to list Active Approval requests, please type 'Status (Approvals)'.Active */
Result <> "Approve" && Result <> "Reject";
OwnerName = User().FullName
)

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Highlighted
Helper V
Helper V

Re: Filter formula

You'll need another field inside your collection or data source that stores the user's info and then add an additional filter on top of your current filter. For example,

Filter(Approvals,
	Status = 'Status (Approvals)'.'0',
	Result <> "Approve" &&
	Result <> "Reject" &&
	UserField.Email = User().Email)

 

 

Highlighted
Helper V
Helper V

Re: Filter formula

Hi @hnguy71 

 

I understand, but in this case UserField is the owner and I can't get it

Do you have an idea of ​​this?

Highlighted
Helper V
Helper V

Re: Filter formula

Captura de Pantalla 2019-08-18 a la(s) 14.15.01.png

Highlighted
Helper V
Helper V

Re: Filter formula

Oh you're trying to filter by who created the record? Honestly, you shouldn't rely on the default fields that CDS has. It's better that you create your own new field and call it something generic like RecOwner and as you create a new entry, drop the current user's name into the field. The field you're trying to pull is a lookup field and is out of scope. If you don't want to create a custom field then this formula might work for you:

Filter(Approvals,
	Status = 'Status (Approvals)'.'0',
	Result <> "Approve" &&
	Result <> "Reject" &&
	User().FullName in 'Created By'.'Full Name')
Highlighted
Community Support
Community Support

Re: Filter formula

Hi @octaking ,

Do you want to filter your approval requests based on current login user?

 

I have made a test on my side, please take a try with the following workaround:

Firstly, you need to add Users Entity as data source within your app.

Then please modify your formula as below:

Filter(
AddColumns(Approvals; "OwnerName", AsType(ThisItem.Owner, Users).'Full Name');
Status = 'Status (Approvals)'.Inactive; /* <-- If you want to list Active Approval requests, please type 'Status (Approvals)'.Active */
Result <> "Approve" && Result <> "Reject";
OwnerName = User().FullName
)

Note: The Users represents the Users Entity in your CDS. Currently, there is no way to compare AsType(Owner, Users).'Full Name' formula and User().FullName formula directly within Filter function.

 

Please take a try with above solution, then check if the issue is solved.

 

More details about the polymorphic lookups in CDS, please check the following blog:

https://powerapps.microsoft.com/en-us/blog/owner-customer-and-regarding-for-canvas-apps/

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper V
Helper V

Re: Filter formula

Hi @v-xida-msft 

It doesn't work for me

69059534_2391815307734163_8702630522347585536_n.jpg

Highlighted
Community Support
Community Support

Re: Filter formula

Hi @octaking ,

Where do you put your formula? Within Gallery Items property?

 

If you put your formula within the Gallery Items property, please modify your formla as below (set the Items property of the Gallery to following formula😞

Filter(
AddColumns(Approvals; "OwnerName", AsType(Owner, Users).'Full Name'); /* <-- Modify formula here. Type Owner rather than ThisItem.Owner */
Status = 'Status (Approvals)'.Inactive; /* <-- If you want to list Active Approval requests, please type 'Status (Approvals)'.Active */
Result <> "Approve" && Result <> "Reject";
OwnerName = User().FullName
)

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper V
Helper V

Re: Filter formula

Hi @v-xida-msft 

Thank you very much for your help it worked

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,627)