Skip to main content

Notifications

Community site session details

Community site session details

Session Id : BM6U3k6vTR0lfEyOXFXncq
Power Apps - Building Power Apps
Unanswered

Can a datasource be a variable?

Like (1) ShareShare
ReportReport
Posted on 4 Oct 2023 13:19:38 by 62

Hello,

I have a canvas app with multiple screens that reference the same datasource.  I haev a Dev Sharepoint list that I use to test new features that are to be added to the app.  Is it possible to have a variable set for the datasource so I can change the datasource in one location that will update across the app?

I have a text label that I use to put the version set to a variable so I can update it in one location.

I have tried it and using 'Set(varData, datasource) works but adding the variable does not bring up the data (ex: a dropdown that searches the SP list).

  • Michael E. Gernaey Profile Picture
    39,080 Super User 2025 Season 1 on 07 Apr 2025 at 04:36:26
    Can a datasource be a variable?
     
    If you want this, you should use Environment Variables. As it is exactly what you are explaining.
     
    You would create an environment variable that would Connect to Dev, when you are running in Dev, then it would connect to Test, UAT, Prod or whatever when you are in those. It simply is updated as you install the solution and bingo bango done. literally 2.5 seconds
     
    As a matter of fact, if you turn on the setting for it to automatically created DataSource Environment Variables... you won't even have to do that. Just turn on the feature.
     
    It sounds like maybe you thought it was something else?
     
    As @Pstork1 mentioned it with the link, I thought maybe there might be some confusion as really its the correct answer. The only additional point was me saying to turn on it doing it for you automatically.
     
    Would love to understand :-) so we can make sure its understand and if you found some issue we can let others know too.,
     
    If this helps you, please Mark as such.
  • CPGDallas Profile Picture
    62 on 03 Apr 2025 at 20:13:42
    Can a datasource be a variable?
    I decided to completely separate the app and dev datasource. It will mean a bit more work when I finalize the app when working with the dev datasource but in the long run it's an overall improvement.  The app would need to have both datasources connected and I really don't need a dev datasource hanging out in the background of my prod app.
    Thank you for the info.
  • Pstork1 Profile Picture
    65,699 Most Valuable Professional on 04 Oct 2023 at 13:28:14
    Re: Can a datasource be a variable?

    If the datasource is SharePoint, Dataverse, or SAP then you can use an Environment Variable for the data source.  But other than environment variables there is no way to use variables to manage data sources.  You can read about environment variables here: Use environment variables in solutions - Power Apps | Microsoft Learn

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.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,518 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,699 Most Valuable Professional

Leaderboard