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!
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