Power Apps Data Sources: Navigating Renaming and Source Code Modifications
Introduction:
Renaming data sources in Power Apps is a vital skill, especially after alterations in Power Apps’ naming conventions for SQL tables and views. This blog elucidates the importance of renaming and offers a comprehensive guide to modify the name of a table or data source in a canvas app using source code adjustments.
Why Rename Tables or Data Sources in Power Apps?
The ability to rename data sources in Power Apps is pivotal for multiple reasons:
- Facilitating migration from one storage provider to another, like from Excel to SQL.
- Cleaning up formulas after deleting and re-adding a data source.
- Addressing the recent naming convention changes in Power Apps for SQL tables and views.
Understanding the New SQL Naming Convention
Earlier, Power Apps added SQL Server tables and views using a convention encompassing the schema and table name (e.g., ‘[dbo].[Issue]’). However, recent updates have altered this, excluding the schema and table name from square brackets, which can lead to potential complications for developers.
Renaming Data Sources: A Two-Fold Perspective
This guide will discuss two renaming methods:
- Renaming a new data source to fit the old naming convention.
- Modifying an existing data source to adapt to the new naming convention, and updating all formula/control references accordingly.
Extracting Source Code for App Modification
To begin, extract the source code for your target app. Save it as an MSApp file and use the pasopa
utility for unpacking. For in-depth details on pasopa
, and unpacking an msapp
file, kindly contact us.
Steps to Rename a Data Source
To exemplify renaming, consider renaming the ‘Client’ data source to ‘[dbo].[Client]’. Three primary files need modification:
- DataSources\.json
- Connections.json
- pkgs\.json
Updating Controls and Formulas Post Data Source Renaming
To demonstrate this, consider renaming ‘[dbo].[Issue]’ to ‘Issue’. Similar to the above steps, three files need adjustments. Moreover, using a tool like Visual Studio Code can help find and replace all instances of the original data source name in screen YAML files.
Conclusion:
Renaming data sources by manipulating the canvas app’s source code is an effective way to mitigate potential issues arising from Power Apps’ SQL Server naming convention changes. Whether it’s about migrating to another storage provider or simply ensuring consistency in your app, this guide provides a robust way to handle Power Apps data sources. For any queries or further assistance, feel free to contact us.
Struggling with any part of this process? Our team is here to help. Get in touch through our contact page and let us assist you with any technical challenges.