Ignite Microsoft today introduced Power Fx, a low-code language for its Power Platform, but it is not altogether new, being extracted from the existing formula language for what the company calls canvas apps.
The company has long been in search of some equivalent to Visual Basic for the cloud, that would allow non-programmers to piece together business applications. Microsoft settled on Power Apps as its primary solution. Power Apps is a composite of several pieces.
The heart of it is Microsoft Dataverse, formerly known as the Common Data Service, which is the data platform for Dynamics, supplemented by custom data and connectors to other sources such as SQL Server. There are three kinds of Power Apps: model-driven apps, which look very much like forms built on Dynamics CRM; Canvas apps, where the developer starts with a blank sheet; and Portal Apps, which are websites built on Dataverse.
Canvas Apps support an Excel-like formula language, and Microsoft is now extracting this from Canvas Apps to give it wider applicability as well as a name: Power Fx. The fact that it is Excel-like is significant, since Microsoft seems keen to appeal to spreadsheet-wielding businessfolk.
When Microsoft renamed Common Data Service to Dataverse, it changed the terminology for table data from records and fields to rows and columns, perhaps for the same reason. “Hundreds of millions of people create spreadsheets with Excel every day, let’s bring app creation to them that is easy and leverages Excel concepts that they already know,” the company said on the Power Fx Github repository.
Micrsoft plans to expand Power Fx to cover model-driven apps, Dataverse calculated columns, Power Virtual Agents (chatbots), and Power Automate (workflows). The Github repository is currently just documentation: running Power Fx requires “a free Power Apps trial.”
The overview document explain that Power Fx is formula-based. One of the examples given was a panel which changes colour as a slider is dragged. There is no event handler for the slider, but the background fill is defined by a formula which includes the value of the slider. “If the color isn’t working as expected, you need to look at this one formula,” it said.
A further aspect of this is that applications are always live; there is no compile or run mode. “An incremental compiler is used to continuously keep the program and the data it is operating on in sync,” explained Microsoft.
The company said that Power Fx automates and simplifies things that require effort in other languages, examples being asynchronous code (always used), server-side versus client-side code (“Power Fx automatically delegates what it can to the server”), relational data (“the maker can use simple dot notation to access the entire graph of relationships from a record”), and selecting columns of data (Power Fx only retrieves what it thinks it needs).
Professional coders often prefer to use editors like Visual Studio Code rather than visual environments, and to place code under source code control. Power Fx makes this possible by embedding formulas in YAML source files. YAML syntax is not the easiest to get right so it is less likely that the low-code business users will enjoy this option.
Microsoft described Power Fx as declarative and functional, though not completely so. “We favor pure functions without side-effects,” the docs said, though, “apps by their nature do mutate state .. some functions therefore do have side effects.”
The language is also said to be strongly typed, though types are inferred from use and not specifically declared. Technically though, the types of all values are known at compile time. It is not object-oriented.
An unusual feature is that every Power Fx document includes a “language version stamp” which means it will run correctly even if it is old code and the latest runtime has breaking changes. If the document is then opened for editing, the system rewrites formulas automatically to match the new runtime.
An issue with Power Fx is that it is tied to Microsoft’s Power Platform, and therefore cannot catch on as a language for wider use – unless you count the fact that it borrows so much from Excel.
Another issue is that a platform which aims to be smart can be frustrating if it does not do what the developer intends, since it is a black box which gives limited options for tracing into what the code is doing. The message is clear though: Power Fx is what developers have to tangle with in order to build advanced applications in Microsoft's low-code environment. ®