cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
vsslasd
Level: Powered On

Easily Switch between SQL Server Tables

We have a production PowerApps application which reads data from our production SQL views writes data to our production SQL tables.

 

We need to make modifications to our PowerApps App, but wish to ensure that our testing and modifications are being performed using  development SQL Tables and SQL Views.

 

What is the simpliest method to easily point and repoint our WIP PowerApp using development and production SQL Data ?

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Easily Switch between SQL Server Tables

Hi @vsslasd,

If I am understanding your question correctly, I think you can use a set of global variables to create aliases for your datasources.  You would use the Set() function on a button on the screen to do it. You would have the variable wherever you are using the datasource. Button1 could be

Set(var1, testingds1); Set(var2, testingds2); etc

Button2 could be

Set(var1, productionds1); Set(var2, productionds2); etc

Once you were done testing, just switch back to button2 and hide the buttons and put a Select(Button2) in the OnVisible property of your screen or the second series of Set() commands for the production version in the OnStart property of the first screen.

If you wanted to go back to the testing version, you would simply unhide button1. 

5 REPLIES 5
Community Support Team
Community Support Team

Re: Easily Switch between SQL Server Tables

Hi @vsslasd,

 

I am not sure I understand your full scenario.

But if here you would like to work with the SQL Views, then please check:

Using SQL Server Views in PowerApps

 

For other part of how to work with SQL Server connection, see:

SQL Server in PowerApps

 

Best regards,

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
vsslasd
Level: Powered On

Re: Easily Switch between SQL Server Tables

For example, our PowerApps app may point to 10 SQL Server Production Views, and 7 SQL Server Production Tables.

 

We need to Point to 10 SQL Server Production Views and 7 SQL Server Production Tables with our Production Power Apps App,

 

For Testing and Development and Change Management, we need to point the 10 SQL Server Views and 7 SQL Server Tables to our Development/Testing environment.

 

We need to easily point and repoint these SQL sources easily so we can contain the Change Management.

 

We are looking for the Best Practice/most efficient way to do this, without having to revise all of our Patch Statements, and our Clear Collection statements in the App.

 

We do not see a simple way to do this.

 

Is there a methodology in place to do this?

 

 

Super User
Super User

Re: Easily Switch between SQL Server Tables

Hi @vsslasd,

If I am understanding your question correctly, I think you can use a set of global variables to create aliases for your datasources.  You would use the Set() function on a button on the screen to do it. You would have the variable wherever you are using the datasource. Button1 could be

Set(var1, testingds1); Set(var2, testingds2); etc

Button2 could be

Set(var1, productionds1); Set(var2, productionds2); etc

Once you were done testing, just switch back to button2 and hide the buttons and put a Select(Button2) in the OnVisible property of your screen or the second series of Set() commands for the production version in the OnStart property of the first screen.

If you wanted to go back to the testing version, you would simply unhide button1. 

vsslasd
Level: Powered On

Re: Easily Switch between SQL Server Tables

Excellent !

Thank you. That will work !

vsslasd
Level: Powered On

Re: Easily Switch between SQL Server Tables

No, unfortunately this does not work.

What actually occurs, it seems is that it creates a static (not dynamic) collection of the datasource at the Set execution point in time.

 

This will not work.

 

I thought this would work as an Alias, which would have been perfect, but this does not work like an Alias at all, just a static collection, which will not resolve the issue or question at hand unforunately.

 

Microsoft, can you please look into resolving this as an Alias, and then that would work perfectly well.


Thank you.