Named Formulas in Canvas Apps is now a fully-fledged feature, no longer experimental. It allows us to define constants in our Canvas Apps, thereby eliminating the necessity for setting everything as variables in the OnStart property of our Apps. This provides a more streamlined and efficient approach.
Microsoft introduces an old Excel concept, Named Formulas, to Power Fx that simplifies app initialization, reduces load time, reuses logic, and improves maintainability.
In Excel, you can name any cell and refer to that name throughout the workbook. It allows you to move that cell reference by name rather than by location, and bind a name to a formula that isn't in a cell. Now, this feature is brought to Power Fx, letting you create your own properties and points of reuse.
Consider this example:
UserEmail = User().Email; UserInfo = LookUp( Users, 'Primary Email' = User().Email ); UserTitle = UserInfo.Title; UserPhone = Switch( UserInfo.'Preferred Phone', 'Preferred Phone (Users)'.'Mobile Phone', UserInfo.'Mobile Phone', UserInfo.'Main Phone' );
These formulas express how to calculate UserEmail, UserInfo, UserTitle, and UserPhone from other values.
With the introduction of named formulas, we are addressing the second main reason for using OnStart— setting up global variables. Here's how you can translate Set calls into named formulas:
BoardSize = 70; BoardLight = RGBA(240,217,181, 1); ...
You can also decouple the definitions of PlayerId, AdminMode, and ReviewGo:
PlayerId = If( !IsBlank( Param( "TestPlay" ) ),
Lower( Param( "TestPlay" ) ),
Lower( Left( User().Email, Find( "@", User().Email )-1 ) )
);
...
Named formulas are an experimental feature in version 3.22091. The App.Formulas property will only appear if the Named formulas experimental feature is enabled in Settings > Upcoming features > Experimental. As an experimental feature, it's recommended not to use named formulas in production apps.
Inspired by Excel's Lambda function, a colossal step forward is planned for Power Fx— user defined functions written directly in the formula language. The plans also include making canvas components generally available, enhancing component properties, and making user defined functions easier to create and reuse. The specific dates for these features are not yet decided.
Share your feedback on how you'd use this new feature in the Power Apps experimental features community forum.
Named Formulas in Canvas Apps is a remarkable innovation in application development. It permits developers to outline constants within the apps themselves negating the requirement to set up variables for every single aspect which was previously done in the OnStart property of the Apps. This translates to enhanced efficiency and a more refined procedure. The formal training offered on Microsoft products further boosts one's skill set within this domain.
Named Formulas in Canvas Apps allows us to define constants in our Apps, which eliminates the need to set everything as variables in the OnStart property. With this feature, we can now use constants to store values which will make the app more efficient and easier to use. We can also use constants to store rules used in the app, such as date, time, and text formats, which will ensure our app is consistent. Additionally, constants can also be used to store text messages or other pieces of information that will be reused by the app. Finally, constants can also be used to store data that will be used in calculations or formulas in the app.
To take advantage of this feature, we need to learn how to use the Named Formulas in our Canvas Apps. We need to understand how to create, modify, and delete constants, and how to use them in calculations and formulas. We also need to understand the different types of constants that are available to use, and how to set up conditions for them. Finally, we need to understand how to use constants in expressions and queries in our apps.
In addition to learning about Named Formulas in Canvas Apps, there are other resources available to help us on our journey. Pragmatic Works offers On-Demand Learning packages, Boot Camps, and Hackathons that can help us learn more about Microsoft Teams, Power BI, Power Apps, and Azure. The Community Plan also offers free resources to get us started.
named formulas, canvas apps, microsoft teams, power bi, power apps, azure, on-demand learning, community plan, boot camps, hackathons