Data Management in Power Apps Steps to Rename Field Names in Records

Data Management in Power Apps: Steps to Rename Field Names in Records

Data Management in Power Apps: Steps to Rename Field Names in Records

In the realm of data management, the necessity to modify field names in a record often arises. Understanding how to effectively perform this task ensures that data remains structured and consistent. This tutorial elucidates the formula required to rename these field names when working with Power Apps.

The need to rename field names typically surfaces when one wishes to extract a record from one data source and integrate it into another. In these situations, it becomes imperative to alter the field names of the source record to correspond with those in the target data source.

While dealing with data tables, the RenameColumns function allows users to alter the column name. But, when it comes down to a singular record, there isn’t a direct function available. This guide will unveil a workaround for this challenge.

Method to Rename a Record Field Name

Consider the subsequent formula, which delineates a record and stores it within a variable termed recordVar. In real-world scenarios, this record could be sourced from a database, an API, or a custom connector.

            
            Set(recordVar,
                {
                    GivenName: "Tim",
                    FamilyName: "Leung",
                    Location: "10 Kings Road",
                    Metropolis: "London"
                }
            ) 
            
        

For instance, if the goal is to rename GivenName to FirstName and FamilyName to LastName, the formula to accomplish this modification would be:

            
            First(
                RenameColumns(Table(recordVar),
                              "GivenName", "FirstName",
                              "FamilyName", "LastName"
                )
            )
            
        

To save this modified record within a variable named newRecordVar, use the following formula:

            
            Set(newRecordVar,
                First(
                    RenameColumns(Table(recordVar),
                                  "GivenName", "FirstName",
                                  "FamilyName", "LastName"
                    )
                )
            )
            
        

The new structure of this record can be verified within the Power Apps designer.

Conclusion

While Power Apps lacks a dedicated “RenameFields” function for renaming fields of individual records, the mentioned approach provides a viable solution. By transforming the record into a table and utilizing the RenameColumns function, field names can be efficiently renamed.

If you’re in search of more assistance related to this topic, or any other technical inquiries, don’t hesitate to contact us. Our team is equipped and eager to aid you further.

About The Author