Announcements
hi all,
i am workin on an app that pulls user comapny from AD profile and based on that it provides the resource (SPO list) to read or write... works great. The problem or challenge is that i have to put in the switch in so many places. I was wondering if someone actually figured out how to have one place where i make the switch and that should feed all the other controls with the right values (compared to do the switch at every button/gallery,..etc..)
Hi @Sifu
Did you try to use global variables? You can use switch on the OnStart property of the app and then assign a variable to that. Then use that variable on your controls.
I had that idea but does not look like that gallery or patch can use a variable for source...
You're right unfortunately you can't assign a variable for a data source. It may be more convenient if you have all of your SPO lists combined in one list, then have a column to distinguish between them. So that in your app you can filter by that column based on your condition.
I dont think this can work. For the app, the source name in the SPO List would be just text... Can u show me how u mean it?
Ok first,
1. How many SPO lists do you have (that you are including in your switch function)?
2. Does the lists have different columns (column names, etc) from each other?
for example i have a gallery that should read from the list "X" if user profile company name = "A", or from list "y" if company name is "B"... I assume you want to crate a list where you include these but from what i tested the values in the "mapping table" would be just text
Okay thanks for clarifying. No, I meant combine list X and list Y into one list (lets call it list XY). Then out of that combined list (list XY), just add a column (Let's call it 'ProfileCompanyName') indicating what profile company name it is. That way you can use filter in your galleries. For example, you can use this in the Items property of your gallery:
Filter('list XY',ProfileCompanyName="A")
We can replace "A" with a variable.
That way, you don't need to create a Switch function with multiple arguments
ok i see but not good for my case... i need to use separated lists for security reasons, different access/permissions since different company and users
I see. You could set item-level permissions (certain groups can only see certain rows) in your SP list, and it won't be different from having separate lists inside one tenant with different permissions per list, but that would probably need some more work if you would modify it now. But it can be worth considering for future projects.
yes, surely something to consider but the permission might be harder to maintain if you add groups later and similar... but see your angle... for now I stay with switch.
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.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 505
WarrenBelz 502 Most Valuable Professional
Haque 324