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

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
TimRohr
Solution Sage
Solution Sage

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
TimRohr
Solution Sage
Solution Sage

Does something like:

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

 

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

Anonymous
Not applicable

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 ?

Anonymous
Not applicable

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

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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,115)