Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

"Dynamic" connection to Sharepoint Lists

(1) ShareShare
ReportReport
Posted on by 22

Hello,

 

We have a solution that requires to split data into several similar Sharepoint lists: they have the same field/column structure and the only difference is the data per region.

 

We've tried setting a variable with the desired list to connect and it worked, for a while. Here's what we did:

 

Set(glDataSource,Switch(varDataSource,1,List01,2,List02,3,List03,4,List04,5,List05,6,List06,7,List07));

 

 

So depending on a choice made in the app's main screen, we'll have a number indicating which list will be used. Like this:

 

ShowColumns(Filter(glDataSource,Product = varProducttoFilter ),"ID","Column1","Column2","Column3")

 

 

So with just one line we can connect on the "active" list without any hassle. As said, it worked until we've reached the row limit for delegation (even though there is no clear indication of delegation). We did tests and seems that when connecting through this way, everything becomes not delegable.

 

So, is there any other idea to connect on different list based on a indicator stored in a variable? 

 

I'd like to avoid doing something very manual like this:

 

[...Code...]

Switch(varDataSource,
 1,ShowColumns(Filter(List01,Product = varProducttoFilter),"ID","Column1"),
 2,ShowColumns(Filter(List02,Product = varProducttoFilter),"ID","Column1"),
 3,ShowColumns(Filter(List03,Product = varProducttoFilter),"ID","Column1"),
 4,ShowColumns(Filter(List04,Product = varProducttoFilter),"ID","Column1"),
 5,ShowColumns(Filter(List05,Product = varProducttoFilter),"ID","Column1")
);

[... Code ...]

 

Thanks in advance!

Categories:
  • Verified answer
    BCLS776 Profile Picture
    BCLS776 8,988 on at
    Re: "Dynamic" connection to Sharepoint Lists

    As you've discovered, Power Apps cannot link to a data source dynamically at run time - all data sources have to be pre-defined so the service can enforce data types.

     

    The way of handling optional data sources using a Switch() statement will work. Another option, if it fits your use case, is to make completely separate apps for different regions. Each app would then only need to connect to daa sources applicable to its region.

     

    Hope that helps,

    Bryan

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard