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

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
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
Super User III
Super User III

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.

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

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
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Solution Authors
Top Kudoed Authors
Users online (8,985)