What are Power Apps Named Formulas
Image Source: Shutterstock.com
Power Apps
Jan 14, 2024 8:00 AM

What are Power Apps Named Formulas

by HubSite 365 about Craig White

Talks about #lowcode, #formula1, #powerplatform, #empoweringothers, and #digitaldisruption

Citizen DeveloperPower AppsLearning Selection

Boost app efficiency with Power Apps named formulas – revolutionizing performance & maintainability.

Key insights

 

Power Apps Named Formulas became generally available (GA) in November 2023, offering a new feature to enhance app performance, scalability, and maintainability. Named formulas allow for the definition of values or objects for use throughout an app, similar to variables or collections.

Abusing the OnStart property of a canvas app can lead to long wait times for app loading. With named formulas, creators can avoid such issues, ensuring points of reference stay current in real-time without the need to reset variables or rebuild collections.

Accessing named formulas is simple; they are located in the same area as the OnStart property. When editing an app, you can find them under 'Formulas' in the property drop-down, making it convenient for developers to implement named formulas in their designs.

Naming conventions for named formulas can be tricky to standardize. The author suggests using prefixes like nf to indicate named formulas, aiding other developers in identifying and understanding their use within an app.

Named formulas in Power Apps are advantageous for various use cases that were traditionally handled by the OnStart property, such as capturing logged-on user info and counting records. Their self-updating nature removes the need to rerun code for current values, simplifying the app's behavior and reducing redundancies in code.

Building collections from data sources and manually, along with theming and getting environment variable values, can benefit from using named formulas. These not only improve the app's performance but also its structure by reducing logic in the OnStart property.

Creators must decide whether to use named formulas or traditional methods based on whether the reference data will change during a session. Despite their benefits, it is essential to remember that not all OnStart functionalities should be moved to named formulas; strategic planning based on user interaction remains crucial.
For more insights on Power Apps and the Power Platform, consider subscribing to the author's content updates.

Exploring Power Apps Named Formulas

Power Apps Named Formulas are bringing a notable shift in how developers manage and utilize data across their applications. By allowing the creation of reusable definitions that remain up-to-date in real time, these formulas are helping to streamline app development on Microsoft's Power Platform. They tackle traditional challenges associated with initializing apps and help maintain clean, efficient, and dynamic codebases. They've become especially useful in complex apps with large datasets, where performance optimization is key. This feature is a testament to the evolving nature of Power Apps, demonstrating Microsoft's commitment to providing tools that foster a more development-friendly ecosystem.

In September 2022, the named formula feature was introduced experimentally in Power Apps, becoming generally available by November 2023. This feature adds significant value to the platform by enhancing app performance, scalability, and maintainability. Named formulas allow creators to define an object or value once and subsequently use it throughout the app, much like variables or collections.

Named formulas help streamline Power Apps by reducing the need to overpopulate the OnStart property, which had been a common practice. Prior to named formulas, developers would move static data into variables, even though variables are meant for data that changes. Now, named formulas update in real time, reducing the need to reset variables or rebuild collections.

The article explains the benefits of using named formulas over traditional methods and notes the ease of keeping them updated. Additionally, Microsoft provided a detailed release note on Power Apps named formulas when they were first released, guiding users through their implementation.

One key detail for developers is to know where to locate named formulas, which is the same place as OnStart in the app editing interface. As for the naming convention, the blog suggests starting with consistent prefixes but still remains unsettled on a definitive standard, though "nf" is used as an example.

The author provides example data, pointing out the setup process for onboarding tasks in a Dataverse table and connecting to Office 365 Users. He highlights the importance of ending named formulas with a semicolon and offers some visual insight into their usage.

Specific use cases like retrieving logged-on user information, counting records, and building collections are discussed. Named formulas update automatically to reflect changes, unlike global variables which need their code to be rerun. Adopting named formulas can eliminate the need for duplicating code or repetitively adjusting the OnStart logic.

The blog post also covers themes and environment variable values, which traditionally are loaded at app start. By using named formulas, these configurations are effectively loaded only when necessary, optimizing app performance. However, certain operations, such as calling Power Automate flows, cannot currently be done with named formulas.

Deciding whether to use named formulas or traditional Power Fx, the author suggests that if data won't change during a session, named formulas are best. However, for changing data, OnStart or other properties may still be relevant. Importantly, the move to named formulas should be strategic and not simply shifting issues from one area to another.

Finally, the author invites feedback on the use of named formulas and offers assistance with any uncertainties regarding their application. Readers are encouraged to share their own experiences and subscribe for more Power Platform tips, though there's no request to subscribe or reference to promotional content in the summary provided.

Read the full article Power Apps Named Formulas

 

Power Apps - Excel PowerApps Integration: Master Named Formulas

 

 

People also ask

What are named formulas in PowerApps?

Named formulas in PowerApps, also known as named functions, are pre-defined calculations that you can assign a name to within the app. Once a formula is named, it can be reused across different controls and screens in your PowerApps application without having to rewrite the formula each time. This feature promotes efficiency, consistency, and maintainability within the app development process.

How do you write formulas in PowerApps?

Writing formulas in PowerApps is similar to writing formulas in Excel. The formulas are written in the formula bar, and they can be used to perform calculations, manipulate data, or govern the behavior of controls. Formulas in PowerApps are based on a combination of functions, operators, and values. You begin by selecting a control or setting, such as "Text" for a label, and then you enter the required formula. PowerApps offers IntelliSense to assist with writing formulas by providing suggestions and auto-completion features.

Which formula returns the full name of the current PowerApps user?

The formula to return the full name of the current PowerApps user is User().FullName. The User function provides information about the current user, and the .FullName property returns the user's full name as a string. This information is based on the user profile data in Microsoft 365.

What is the ForAll formula in PowerApps?

The ForAll formula in PowerApps is an iteration function used to process records in a table, a collection, or other enumerable data sources. It evaluates a formula for all records of a specified table. For each record, the formula can perform operations such as calculations, creating or modifying data, and evaluating conditions. The result of the ForAll function is a table where each row represents the result of the formula evaluated for a specific record. For example, ForAll(Tickets, Concatenate(TicketNumber, " - ", TicketDescription)) would create a new table with one column that contains a string of the ticket number and description concatenated for each record in the Tickets source.

 

Keywords

PowerApps Named Formulas, Microsoft Power Apps Formulas, Power Apps Custom Names, Power Apps Formula Reference, Power Apps Naming Conventions, Create Named Formulas in PowerApps, Power Apps Expression Names, Power Apps Named Variables, Power Apps Formula Management, Power Apps Efficient Naming.