cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Populating Gallery list on a condition

Hello, 

 

I am building an app and on one screen, i have Three Gallery lists on the screen. Screen No.1 is populated with UserName and UserID. Clicking on any data line of the Gallery No.1 populates the related data from database into the textboxes and dropdowns on that page. I want to Populate the Gallary list No.2 and 3 to be populated based on the UserID of Gallery List No.1 like rest of the text boxes and dropdowns. 

The code is in the Default. Just to make it clear, I have a username and userid on one Gallery List and I want to Populate the Properties related to the UserID in the 2nd list. For Example User with a UserID 1, all the properties related to the UserID 1 should be populated into the Gallery List 2. The data is saved into SQL Azure Database.

Can anyone help please ? Thank you. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Solution Sage
Solution Sage

Re: Populating Gallery list on a condition

Does something like:

Filter(DataSourceOfGallery2,UserID=Gallery1.Selected.UserID)

 

...not work if you put it in the Items property of Gallery2?

View solution in original post

4 REPLIES 4
Highlighted
Solution Sage
Solution Sage

Re: Populating Gallery list on a condition

Does something like:

Filter(DataSourceOfGallery2,UserID=Gallery1.Selected.UserID)

 

...not work if you put it in the Items property of Gallery2?

View solution in original post

Highlighted
Frequent Visitor

Re: Populating Gallery list on a condition

Hello, 

Thank you for the response. Unfortunately the suggested solution will not work. In terms of SQL Query, It is something like this what I want to do

Select UserProperties from dbo.User_B_Tab where UserID=1001

So all the user properties of a user which is Selected in Gallery List 1 should be populated in Gallery List 2 based on the UserID. I do not know the PowerApp syntax if i have to do this. 
I have tried using the following

LookUp(
    '[dbo].[User_B_Tab]',
        UserID=UserModGallery_List.Selected.UserID,UserProperties
    )

I think this will search for the matching UserID and will return the UserProperties against the UserID. I am getting an error
delete.png
I am not sure if using Lookup will work in Default value of the GalleryList2. Can you help please ?

Highlighted
Frequent Visitor

Re: Populating Gallery list on a condition

Hello @TimRohr

Resolved the issue following your guidelines. i was actually making it too complicated because of my developers background, PowerApps is different 😉

I simply used the user table as a datasource for the Gallery List 2, In the Items property of the Gallery List, I used the following code

Filter(
    '[dbo].[User_B_Tab]',
    UserID = UserModGallery_List.Selected.UserID
)

And in the Gallery List 2, I added a Label, and in the Text property, I have simply called the UserProperties, and it works like a charm. Thank you

Highlighted
Solution Sage
Solution Sage

Re: Populating Gallery list on a condition

In some ways PowerApps makes things easy. In other ways, it makes them... unexpected. Smiley Wink

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,221)