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

FILTER A GALLERY BY CURRENT USER WITH COMMON DATA SERVICE

Hey guys, I got a simple connection on Common data service and I wanna filter the galery by current user, 

 

And I tried this code, but didn't work out...

 

If(User().Email="admin@admin.com.br";'Solicitações de Projeto'; Filter('Solicitações de Projeto';UsuáriosdoOffice365.SearchUser().DisplayName=varUser))

 

Someone have any ideas how to filter?

 

I got this var on my app "OnStart": Set(varUser; User().Email)

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @Gorilla_8 ,

 

Do you mean filter the gallery to only show the item created by users, right?

If so, please try this:

If(
Lower(varUser)="admin@admin.com.br";
'Solicitações de Projeto'; 
Filter('Solicitações de Projeto';'Created By'.'Primary Email'=varUser)
)

Hope this helps.

Sik

View solution in original post

9 REPLIES 9
eka24
Super User
Super User

Try:

If(User().Email="admin@admin.com.br";'Solicitações de Projeto'; Filter('Solicitações de Projeto';UsuáriosdoOffice365.SearchUser({searchTerm:""}).DisplayName=varUser))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi @eka24 

 

Thanks for the reply, but I got a delegation error, I dont know why....

 

status.png

Try:

If(User().Email="admin@admin.com.br";'Solicitações de Projeto'; Filter('Solicitações de Projeto'; varUser  in UsuáriosdoOffice365.SearchUser({searchTerm:""}).DisplayName))

 

Or

Create a Collection onstart:

 Set(varUser; User().Email);

ClearCollect(MyUsers,Office365Users.SearchUser({searchTerm:""}).DisplayName)

 

Then filter as:

If(User().Email="admin@admin.com.br";'Solicitações de Projeto'; Filter('Solicitações de Projeto';  varUser in MyUsers))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi @eka24 ,

 

I tried the first filter, but i got a delegation error on "in"...

 

delegation on iin.png

 

So, like you suggest, I tried the second one...

 

 

error second one onsart.png

 

The error says: The function clearcollect has invalid arguments

 

 

I dont get that error

Users.JPG

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Me too...I dont get it

You have a semi-colon where you should have a comma between MyUsers and Office365Users.

v-siky-msft
Community Support
Community Support

Hi @Gorilla_8 ,

 

Do you mean filter the gallery to only show the item created by users, right?

If so, please try this:

If(
Lower(varUser)="admin@admin.com.br";
'Solicitações de Projeto'; 
Filter('Solicitações de Projeto';'Created By'.'Primary Email'=varUser)
)

Hope this helps.

Sik

Hi @v-siky-msft ,

 

The filter you suggest stoped work:

 

filtergallery.png

 

If(
Lower(varUser)="admin@admin.com.br";
'Solicitações de Projeto'; 
Filter('Solicitações de Projeto';'Created By'.'Primary Email'=varUser)
)

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,030)