cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Data Sources as a Dropdown

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

11 REPLIES 11
Highlighted
Responsive Resident
Responsive Resident

Re: Data Sources as a Dropdown

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

Highlighted
Responsive Resident
Responsive Resident

Re: Data Sources as a Dropdown

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.

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Data Sources as a Dropdown

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

Highlighted
Responsive Resident
Responsive Resident

Re: Data Sources as a Dropdown

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.

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Data Sources as a Dropdown

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. 

Highlighted
Responsive Resident
Responsive Resident

Re: Data Sources as a Dropdown

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)

Highlighted
Responsive Resident
Responsive Resident

Re: Data Sources as a Dropdown

Did you manage?

Kudo Kingpin
Kudo Kingpin

Re: Data Sources as a Dropdown

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.

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Data Sources as a Dropdown

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:

  {
        DSName: "EUR",
        Sources:
{
            TimeSpent: 'timespentlistfromEUR site',
            Requests: 'requestlistfromeursite'

        }
    },
    {
        DSName: "APAC",
        Sources:
        {
            TimeSpent: 'timespentlistfroAPAC site',
            Requests: 'requestlistfromAPACsite'

        }
    }
  
  

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,951)