My PowerApp application decides the Share point list to filter based on user details. For example, the Share Point list would change based on the region the user belongs to.
Share Point List:
SalesTableEU
SalesTableUSA
The mapping of User and the Sharepoint list to use is in another table named UserSettings.
First, i did a look up on UserSetting list, returned the SPListName (TableName) based on the user. This saved in a variable named SelectedDS (app, onStart) by
Set(SelectedDS, LookUp(UserSPLMapping, Title = User().Email, SPListName))
How should i pass the table name to the filter function (first landing page) based by this variable name - SelectedDS.
SortByColumns(Filter(SelectedDS, StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))
I do not get the gallery populated when i use this variable, however when i hard code the table name, the gallery is populated.
Can you help me where i'm wrong and provide me a solution.
You cannot refer to datasources indirectly like that. You need to provide the actual name.
You can change your items to various datasources based on a condition.
ex.
Switch(condition,
"condition1", Filter(Table1, criteria),
"condition2", Filter(Table2, criteria),
...etc...
)
But this is VERY risky to do in PowerApps unless the sources are EXACTLY the same and you have no plans to use any Forms in your app.
Consider putting the Galleries, Forms and anything else you need in the app for all of your datasources and then just hide and display the appropriate screens or controls based on the region the user is in.
I hope this is helpful for you.
Don't believe you can do what you're trying to do. Set up multiple galleries and then show/hide them based on the value of SelectedDS.
WarrenBelz
223
Most Valuable Professional
MS.Ragavendar
110
stampcoin
86