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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using SQLServer to cre...
Power Apps
Unanswered

Using SQLServer to create two linked galleries - can it be done?

(0) ShareShare
ReportReport
Posted on by 72

Hi there,

 

I've been working on this issue for five days now, and being a newbie to PowerPlatform, am somewhat pulling my hair out. (i'm already bald, so... there's that)

 

I'm creating a Powerapps canvas app, and from a previous post on here have learned it's not possible to have a gallery linked to more than one Data Source. 

 

So, thanks to the aforementioned issue, in SQLServer I've created two tables (I actually need 8 but - two for now).

 

TableA, is defined by the names of the other tables I want to store inside and contains two columns, "FolderID" varchar(50), and "DisplayName" varchar(50). The primary key is "DisplayName". I did have another column called [TABLE] which contained dbo.tableB as a value, but this didn't work. TableA is displayed on a screen of its own (browsescreen), and when in a gallery will link to the respective table item of TableB on a different screen (detailscreen).

 

In TableB, the columns are: "Month" varchar, "PreviousYear" int, "CurrentValue" int, "Benchmark" int, "Target" int & "DisplayName" varchar, which is the foreign key.

 

However, when the browsescreen gallery is created, regardless of the relationships I've created between the two tables, the respective connection to the "display form" for tableB on the detailscreen, cannot be made. Is there something I can do to remedy this, which doesn't involve laptop defenestration.

 

I'm going round in circles and would be grateful for any advice.

 

Cheers in advance.

 

 

Categories:
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @wilfordm81 Can you paste in the chat the formulas you have in the Items property of both the galleries.

  • wilfordm81 Profile Picture
    72 on at

    Hi @CNT,

     

    Thanks for responding!

     

    I haven't yet created any working/viable formulas, and is why I'm wondering if it's actually possible..? 🙂

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @wilfordm81 Very much possible. In fact you can display data from any number of tables in one Gallery. You have to combine all the columns from different tables and use that combined output as the Items for your gallery.

    Meanwhile,

    Please remember to give a 👍 and accept my solution as it will help others in the future.

  • wilfordm81 Profile Picture
    72 on at

    Do you mean, by creating a collection from a trigger?

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @wilfordm81 Either by a trigger or in the OnVisible of the Screen or can be directly in the Items property of the Gallery. Get started!

  • timl Profile Picture
    37,420 Super User 2026 Season 2 on at

    Hi @wilfordm81 

    In order to display multiple tables in the gallery, I would recommend that you build a in SQL Server that unions your 8 tables.

    CREATE VIEW vwCombined
    AS
    Select '1' AS TableID, [Month], [DisplayName],[CurrentValue],
    FROM TableB
    UNION
    Select '2' AS TableID, [Month], [DisplayName],[CurrentValue],
    FROM TableC
    UNION
    Select '3' AS TableID, [Month], [DisplayName],[CurrentValue],
    FROM TableD
    etc...

    This will be far more efficient than using collections and will be immune to the delegation problems you will no doubt encounter as a result of using collections.

     

    From your browse screen, you can then set the items property of the gallery to vwCombined. You can then add a button that conditionally navigates the user to the correct display screen like so:

    Switch(ThisItem.TableID,
     1, Navigate(DetailScreenForTableB),
     2, Navigate(DetailScreenForTableC),
     3, Navigate(DetailScreenForTableD)
    )

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard