cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

How to see gallery items properly if I have multiple different Items

Hi,

 

I would like to create an application where multiple cds tables are used and based on the previous user's choice a gallery is visible with the desired table as item.

 

Useres can set either ShowsAccounts or ShowsLeads and based on their choice the next page is loaded where a gallery is visible with the following Items property:

If(ShowsAccounts,SortByColumns(Search(Accounts,TextInput1.Text,"name"),"name",Ascending),ShowsLeads,SortByColumns(Search(Leads,TextInput1.Text,"fullname"),"fullname",Ascending))

 

My problem is the following:

The gallery seems like it uses the desired data source but I dont know how to visualize the data.

 

Let me explain:

If I use simply: If(ShowsAccounts,SortByColumns(Search(Accounts,TextInput1.Text,"name"),"name",Ascending))
Then I see the following:

 

Q1.png
You can see that I see a bunch of records and within the Gallery I set the title to ThisItem.'Account Name'

 

My problem is when I use the above mentioned If statement for my gallery, then I see this:

Q2.png
You can see that in both cases it found the right number of rows, but I do not see the records and ThisItem.'Account Name' is invalid, how can I set gallery items dynamically and then see their values just like I would set them individually? I wanted like If(ShowsAccounts, ThisItem.'Account Name' , ShowsLeads, ThisItem.'First Name') but this is not valid as well.

 

My aim is to have a single gallery to which multiple tables could be set as Items and then the user can see those table's records, currently I have 2 gallerys and set their Items to the desired one and hide the other if the user selects the other one, but I will have approximately 10 gallerys and I do not want to copy paste a new gallery on top of the others and hide.. I would like to create a single gallery where I can see everything just like I would see in a single gallery with a single table.

 

Thanks guys!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @ZsoltDunai ,

Unless the field names and data type you are displaying in the gallery are exactly the same, you are going to have issues with the controls in it "binding" to a field and displaying. You can go down the track of using RenameColumns() on all but one of the tables to match the fields - this would be quite a task with 10.

I know you do not want to do it, but to honest, it is easier to simply have separate galleries and controlling the Visibility of them based on what you want to display. I have one screen wit 18 galleries on it and only one showing at a time.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

2 REPLIES 2
Super User III
Super User III

Hi @ZsoltDunai ,

Unless the field names and data type you are displaying in the gallery are exactly the same, you are going to have issues with the controls in it "binding" to a field and displaying. You can go down the track of using RenameColumns() on all but one of the tables to match the fields - this would be quite a task with 10.

I know you do not want to do it, but to honest, it is easier to simply have separate galleries and controlling the Visibility of them based on what you want to display. I have one screen wit 18 galleries on it and only one showing at a time.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

New Member

Thanks @WarrenBelz ! I thought there is a nice way, but I accept the simple way thanks!

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

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

Top Solution Authors
Top Kudoed Authors
Users online (62,916)