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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Click button and chang...
Power Apps
Unanswered

Click button and change Datasource table on gallery screen.

(0) ShareShare
ReportReport
Posted on by 96

If i have three button and three sharepoint list. And i have one gallery screen.

If i click one button to navigate to gallery screen. My gallery screen code is below:

SortByColumns(Filter( 'PF502X Sample Request', 'Created By'.Email = User().Email , TextSearchBox1_6.Text in 'Part No.' || TextSearchBox1_6.Text in Customer ), "Created", If(SortDescending1, Ascending, Descending))

How to setup button onselect code and gallery screen code can achieve that change button to navigate gallery screen and the gallery screen datasource table will change by the button represent.

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @Dennis_Qiang 
    Put this code in the OnSelect property of your 3 buttons.

    Set(varDatasource, "Table1");
    Navigate(GalleryScreen);
    Set(varDatasource, "Table2");
    Navigate(GalleryScreen);
    Set(varDatasource, "Table3");
    Navigate(GalleryScreen);

     

    Then put this code in the Items property of the Gallery.

    If(
     varDatasource="Table1",
     SortByColumns(Filter('Your Table Name 1', 'Created By'.Email = User().Email , TextSearchBox1_6.Text in 'Part No.' || TextSearchBox1_6.Text in Customer ), "Created", If(SortDescending1, Ascending, Descending)),
     varDatasource="Table2",
     SortByColumns(Filter('Your Table Name 2', 'Created By'.Email = User().Email , TextSearchBox1_6.Text in 'Part No.' || TextSearchBox1_6.Text in Customer ), "Created", If(SortDescending1, Ascending, Descending)),
     varDatasource="Table3",
     SortByColumns(Filter('Your Table Name 3', 'Created By'.Email = User().Email , TextSearchBox1_6.Text in 'Part No.' || TextSearchBox1_6.Text in Customer ), "Created", If(SortDescending1, Ascending, Descending))
    )

     

    Please note: your tables must all have the exactly same number of columns and column names 🙂

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

  • Dennis_Qiang Profile Picture
    96 on at

    Hi @mdevaney 

     

    Can i use the below type?

    For three button,

     

    Set(varDatasource, "Table1");
    Navigate(GalleryScreen);
    
    Set(varDatasource, "Table2");
    Navigate(GalleryScreen);
    
    Set(varDatasource, "Table3");
    Navigate(GalleryScreen);

     

     

     For the Gallery,

     

    SortByColumns(Filter('varDatasource', 'Created By'.Email = User().Email , TextSearchBox1_6.Text in 'Part No.' || TextSearchBox1_6.Text in Customer ), "Created", If(SortDescending1, Ascending, Descending))

     

    Is it possible to store the table in a variable?

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard