cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Lookup gallery details as per field selection

Hello Experts,

 

I have one login screen where i am choosing user name as dropdown and then gallery appears , i want based on my login username galley should appear. 

below is the code i am writing on Item property of gallery.

 

 

SortByColumns(Filter('[dbo].[BG_ACTIVITYCredentials]', StartsWith(Username, TextSearchBox1.Text)), "Username", If(SortDescending1, Descending, Ascending))

 

 Please advise 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

 

That's very clear. So it is simple then.

 

On your login screen you showed above, add a variable on the property of "OnSelect" of the button "Login" (Don't need to remove other formula, just add this one), which is:

Set(UsernameSelected,UsernameDropdown.Selected.Value)

And then in your gallery for the records

SortByColumns(Filter('[dbo].[BG_ACTIVITYCredentials]', Username=UsernameSelected), "Username", If(SortDescending1, Descending, Ascending))

This is to set the username that the user selected on the login screen as a variable, then in the gallery, it will only show the records which is related to the username which I believe in your data source there is a column to store the username.

 

View solution in original post

6 REPLIES 6
ganeshsanap
Super User
Super User

Try setting default value of TextSearchBox1 to User().FullName.

 


Please click Accept as solution if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

 

Jacky_Shen
Resolver IV
Resolver IV

Hi @Anonymous ,

 

My suggestion:

SortByColumns(Filter('[dbo].[BG_ACTIVITYCredentials]', Username=TextSearchBox1.Selected.Value), "Username", If(SortDescending1, Descending, Ascending))

Please try.

Anonymous
Not applicable

Hello @ganeshsanap , thanks for looking into this ,my usernames are the manual usernames which i have defined in one table with passwords. this is not the power app login usename.

Anonymous
Not applicable

Hello @Jacky_Shen thank you , let me explain more , i think i couldnt give clear idea.  this is my login screen. my usernames are the manual usernames which i have defined in one table with passwords. this is not the power app login usename.

Capture40.PNG

whoever user logged in here in gallery data should appear only for this user without searching in search text box.  

The table BG_ACTIVITYCredentials contains username filed too.

Hi @Anonymous ,

 

That's very clear. So it is simple then.

 

On your login screen you showed above, add a variable on the property of "OnSelect" of the button "Login" (Don't need to remove other formula, just add this one), which is:

Set(UsernameSelected,UsernameDropdown.Selected.Value)

And then in your gallery for the records

SortByColumns(Filter('[dbo].[BG_ACTIVITYCredentials]', Username=UsernameSelected), "Username", If(SortDescending1, Descending, Ascending))

This is to set the username that the user selected on the login screen as a variable, then in the gallery, it will only show the records which is related to the username which I believe in your data source there is a column to store the username.

 

View solution in original post

Anonymous
Not applicable

Hello @Jacky_Shen , Thank you so much for the suggestion , i was able to solve this what is what i am writing on gallery items.

SortByColumns(Filter('BG Activity Recorder', 'Employee Name'=Dropdown13.Selected.Result, StartsWith('Activity ID', TextSearchBox1.Text)), "ActivityID", If(SortDescending1, Descending, Ascending))

Dropdown13 is the drop down of username on login screen. now it filter record as per username and search as per activity ID. it is same approach as you suggested.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,656)