Published on

Low-Code Functions

Authors
  • avatar
    Name
    Jason Deramo
    Twitter
pro-code

Microsoft©

Power Fx: A Game Changer for App Development

I know at some point we’ll be discussing Python, SQL, and other technologies but I can’t help but mention Microsoft’s latest code offerings. Principally, the Power Fx formula language.

Microsoft Power Fx is a low-code general purpose programming language based on spreadsheet-like formulas. It is a strongly typed, declarative, and functional language, with imperative logic and state management available as needed. [1]

Similar to Excel, Power Fx handles code recalculation automatically as values change. One popular command within the language is the Patch function:

This feature is useful for storing and modifying data within your apps, without leaving your current screen. It’s similar to how hash tables work in Python, and other coding languages, in that you’re storing records within new or existing data tables to be called upon at a later time (*See sample code below):

Patch(
  source,
  Defaults(source),
  record
)

Bonus (Collect)

Similar to Patch, the Collect function also creates and appends records to a data source. When used with a collection, additional columns will be created as needed. Collections are sometimes used to hold global variables or store a temporary copy of a data source.

Collect(
    ProductList,
    {
        Product: ProductName.Text,
        Color: Colors.Selected.Value
    }
)

Like all things Microsoft, there’s more than one way to skin a cat. However, it’s useful to know these functions often build on each other, so make sure you’re reviewing the proper syntax and understand their limitations before using.

Sources: