I have multiple, identical SharePoint lists and I'd like to load a particular list on all screens based on a global variable called varProject. I'd like to be able to set all forms and galleries to have a data source of colClaimsList, and then switch out the records they display based on a global variable selection set with a button click on the home page of the app.
With the global variable is set, I hoped to create a collection (using ClearCollect) based on the varProject value.
The variable is getting set correctly, but I can't seem to get the collection created. I'm doing stuff like this:
If(
varProject = "Project1",
ClearCollect(
colClaimsList,
'Claims-Project1'
);
If(
varProject = "Project2",
ClearCollect(
colClaimsList,
'Claims-Project2'
)
)
);
Navigate(SELECT)
Is this not possible? Powerapps seems perfectly happy with the syntax but the collection is not being created/populated. It's always empty. Thanks in advance for your help.
Solved! Go to Solution.
You will only be able to do this successfully if the two sources are the same. Otherwise you will start to introduce issues into your app.
Your formula can be set to the following:
ClearCollect(
colClaimsList,
Switch(varProject, "Project1", 'Claims-Project1', "Project2", 'Claims-Project2')
)
Again note, that these should be pretty much identical.
I hope this is helpful for you.
You will only be able to do this successfully if the two sources are the same. Otherwise you will start to introduce issues into your app.
Your formula can be set to the following:
ClearCollect(
colClaimsList,
Switch(varProject, "Project1", 'Claims-Project1', "Project2", 'Claims-Project2')
)
Again note, that these should be pretty much identical.
I hope this is helpful for you.
@RandyHayes Thanks so much! I was experimenting with Switch functions but I didn't have it quite right. This is working for me now.
ClearCollect(
colClaimsList,
Switch(
varProject,
"Project1",
"Claims-Project1',
"Project2",
'Claims-Project2',
"Project3",
'Claims-Project3'
)
);
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
201 | |
177 | |
62 | |
32 | |
30 |
User | Count |
---|---|
317 | |
263 | |
104 | |
76 | |
56 |