web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : 0O6Ew4HUMRNI4Qjh5DMtvw
Power Apps - Building Power Apps
Unanswered

PowerApps choose data source (Tables) in gallery based on button click

Like (0) ShareShare
ReportReport
Posted on 7 Apr 2020 16:42:35 by

Hello everyone,

 

I have multiple tables in my PowerApps with same fields, I just want to choose the table whose button has been clicked on the last page. I am able to navigate to the next page with the variable to check which data source should we choose, I have tried to use Switch statement as follows in the Items of the gallery:

 

Switch(variablefrompreviousscreen,"Match String 1",DataSource1,"Match String 2",DataSource2,DataSource3) but this gives me some errors and doesn't seem to be the solution

 

Please let me know how i can do this. If not, Please specify alternate approaches: I am thinking about have a single table and using the filter or creating my own collection in PowerApps.

 

Your help would help me improve based on this 

  • jKell Profile Picture
    82 on 07 Apr 2020 at 17:32:24
    Re: PowerApps choose data source (Tables) in gallery based on button click

    @Anonymous  I don't know if you can manipulate the "ITEMS" setting with Switch, but you may be able to achieve what you want by playing with the visibility property using your defined variable variable.

     

    1. Place 3 Galleries on the screen you want.
    2. Assign Datasource in the items field of your gallery to the 3 datasources you want to switch between
    3. Modify Visible property using the variable you have defined from the previous page, [EX: If(variablefrompreviousscreen="Match String 1",true,false)]

    Joel

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on 07 Apr 2020 at 17:24:32
    Re: PowerApps choose data source (Tables) in gallery based on button click

    Hi @Anonymous 

    I use Set(ds, Datasource1) to create an alias for various datasources or for different filters and use ds as the Items property of my Gallery. However, the datasource of the gallery must match exactly the datasource of the Edit or View form that you navigate to and the problem is that you cannot use a variable as the datasource of a form.  If you use a different form for each datasource, you will need set the Item property using a Lookup() to the datasource and a unique field.  For example,

    Lookup(Datasource1,ID=Gallery1.Selected.ID)

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2