DEV Community

loading...
Cover image for PowerFX is the new language of Microsoft

PowerFX is the new language of Microsoft

jorgecc profile image Jorge Castro Originally published at southprojects.com ・3 min read

PowerFX is the new language of Microsoft.

Introducing Microsoft Power Fx: the low-code programming language for everyone | Microsoft Power Apps

  • Power Fx is open source.
  • Power Fx is based on Microsoft Excel.
  • Power Fx is built for low code

Alt Text

Well, lets me explain a bit further.

PowerApps is an online service of Microsoft to create small applications for mobile and web. The service is far from perfect but it works for small internal applications because it's easy to work with it.

However... we are talking about Microsoft.

  • First, Power FX is open source and it is not a lie.

  • The second point is "Power FX is based on Microsoft Excel" and it is a lie. The only similarity with Excel is that Power FX and Excel allows functions. Nothing more. Power FX is more close to JavaScript.

  • And the third point, "Power Fx is built for low code". 🤦‍♂️ No!. Power FX is high code in the concept it works for scripting and nothing else much. You can't compile it, you can't create an advanced program with it.

But, there is another point, Power FX is anything but new. I have used it for a couple of years.

About Power Platform

  • Power Apps is not perfect but the script works as expected. However, there is not a single Power Apps but 3
    • Power Apps (the normal version). You can create applications, you can use Power FX and such.
    • Power Apps (portal). You can do anything. There is no scripting or any advanced. You can duct tape some JavaScript on the view but nothing more. You can only create 5 elements: pages, forms (that you can't edit), charts (from Power BI) and a couple more elements.
    • Power Apps (Dynamics). For some odd reasons, Power Apps is tied with Microsoft Dynamics, so it allows to create of Power Apps forms for Dynamics. And it uses another way for scripting (visual business logic)
  • Power Automate, while it works in tandem with Power Apps, but it uses a completely different ideology. It doesn't use scripting at all and it is not aimed at Power FX (even when Microsoft promises an integration). It even uses a distinct way of variables with their own notation.
  • Power BI. And again, it uses another way to scripting called Power Query.

If you are used Power Platform then you are found yourself working with the different styles of programming

The cool about Power FX

Since it is similar to JavaScript, then it is easy to work with it. It is based in functions, so most operations are done using functions.

For example:

If a1 is equals to a2, then the variable is equals to v1, otherwise v2.

set(variable,if(a1==a2,"v1","v2"))
Enter fullscreen mode Exit fullscreen mode

The not so cool about Power FX

It is regional dependent.

Alt Text

For example, it is the code in a computer configured with EN-US.

set(variable,if(a1==a2,"v1","v2"));
set(variable,20)
Enter fullscreen mode Exit fullscreen mode

And it is the same code for ES-ES

set(variable;if(a1==a2;"v1";"v2"));;
set(variable;20)
Enter fullscreen mode Exit fullscreen mode

Should I learn it?

If you are using Power Apps then you already have worked with it. If not, then why? Power FX is (as of today) used in one application and not in every one of their variants.

Also, if you know JavaScript, then you know practically the whole language.

Types PowerApps JavaScript Excel
integer 20 20 20
string "hello" "hello" "hello"
arrays [20,30] [20,30] nope
objects [name:"john",age:23] [name:"john",age:23] nope
using fields user.name user.name nope

Discussion (1)

pic
Editor guide
Collapse
essanousy profile image
mohamed es-sanousy

Nice article, and so fast :D
Until now, I still can't find a way to create a function, it's frustrating to have to copy the same code over and over in power apps