Hi Everyone,
Is there a way to populate a drop down control with all data sources currently connected to a particular application. For Example If i have 5 sharepoint lists with the same fields and want to be able to select a specific list to view its content.
Thanks for the help,
Dave
Try toggle the Items attribute with an If statement first with a variable that shadows the connection name. Sounds great.
But,
When you want to filter a gallery/data-table or update a form. You may need to also create an if statement with the variable to switch the following.
Dropdown.Selected.Result,
Dropdown.Selected.Value,
Dropdown.Selected.Country
or similar
Let us know how you go, I'd be interested
I believe the easiest way to achieve it is to bind each datasource to a different gallery and the based on a specific trigger (ex. a dropdown control having the list of available datasources) to show/hide the proper gallery.
This way each gallery can be customized according to the list most relevant information (may be pictures in ones)
shouldn't be so time consuming for a limited amount of lists ...
Another option is to declare a collection with the names of all sources, bind it to a dropdown and then use the switch function to select the proper datasource.
Ex.
On the form OnVisible:
ClearCollect(DataSources,{DSName:"Source1"}, {DSName:"Source2"},{DSName:"Source3"})
Bind the dropdown to the DataSources collection and then add the gallery and set the Items property:
Switch( Dropdown1.Selected.Value,
"Source1",'[dbo].[view_LeaveBalances]',
"Source2",'[dbo].[view_ActiveEmployees]'
)
However when it comes to binding the gallery items to the corresponding data I only managed when all the datasources had the same data structure including column names.
Hope it helps, please let us know.
bdodu, so if i have a site with a bunch of identical sub sites, i can use a single powerapp to work with each of the subsites? users could select the sub site on the welcome page?
i would love to see a demo of that !!!!
Why not? What's changed?
We are basically talking about putting together a bunch of datasources having the same structure so at the runtime you'll just be directed to the proper collection. Try follow my steps with 2 simple controls - one dropdown and one gallery.
Carefull when it comes to data/users distributed among multiple tenants, hope it's not your case.
single tenant. one site collection with identical sub sites. users may have access to one or more of those sub sites.
a dozen lists in each sub site. i'm new to powerapps , so just trying to figure this out.
Ok, try to follow these steps and let me know the result to better understand how to help you.
1. Create a new app and connect all the lists in each subsite to your app.
2. Define a static collection with friendly names of each list (my first answer step 1)
3. Bind the dropdown to the collection
4. Connect a gallery to the dropdown with the switch statement (my first answer step 2)
5. Having all the data using the same structure and names you can easily bind the controls within the gallery to the underlying data (using ThisItem.whatever-column-name)
By changing the dropdown selection the gallery will display the data from the specific list (within the connected subsite)
Did you manage?
I did not. (I'm really new to this).
I could not figure out how to bind my controls to the selected datasource.
But from what im learning, I think I dont want to bind the controls to the datasource. I just want to set the items property of the controls.
Running into many that are slowing me down.
btw , I have a sharepoint backend.
so i cant do
Switch( Dropdown1.Selected.Value,
"Source1",'[dbo].[view_LeaveBalances]',
"Source2",'[dbo].[view_ActiveEmployees]'
)
Will need to set up each 'source' with multiple datasources". something like:
User | Count |
---|---|
258 | |
111 | |
95 | |
48 | |
41 |