Coder Social home page Coder Social logo

power-fx's Introduction

Microsoft Power Fx

PowerFX usage example, displaying a simple slider

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.

Power Fx started with Power Apps canvas apps and that is where you can experience it now. We are in the process of extracting the language from that product so that we can use it in more Microsoft Power Platform products and make it available here for you to use. That's going to take some time and we will report on our progress here and on the Power Apps blog.

A start on the language documentation is available in the docs folder. As with the implementation, it is being extracted from the Power Apps documentation and generalized and that too is going to take some time.

Summary

Vision

The easiest and most powerful ​system to express business logic for ​everyone, everywhere.

Overview

PowerFX overview video thumbnail For those new to Power-Fx, this video should answer many of your questions:
Power Fx: the Programming Language for Low Code and what it means for Developers

Packages

Name Released Package
Microsoft.PowerFx.Core BotBuilder Badge
Microsoft.PowerFx.Connectors BotBuilder Badge
Microsoft.PowerFx.Json BotBuilder Badge
Microsoft.PowerFx.Core.Tests BotBuilder Badge
Microsoft.PowerFx.Interpreter BotBuilder Badge
Microsoft.PowerFx.LanguageServerProtocol BotBuilder Badge
Microsoft.PowerFx.Transport.Attributes BotBuilder Badge

Daily Builds

Daily builds of the Power Fx packages are published to Azure Artifacts.

https://pkgs.dev.azure.com/Power-Fx/7dd30b4a-31be-4ac9-a649-e6addd4d5b0a/_packaging/PowerFx/nuget/v3/index.json

Samples

There are samples demonstrating how to consume Power Fx at: https://github.com/microsoft/power-fx-host-samples

You can also see usage examples in the unit tests.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

power-fx's People

Contributors

adithyaselv avatar akshar2401 avatar ananya-gupta24 avatar anderson-joyle avatar anhtruong-msft avatar bryancroteau-msft avatar carlosfigueiramsft avatar emhomm4 avatar gregli-msft avatar ian-legler avatar ivanradicek avatar jack-work avatar jas-valgotar avatar jelopezf avatar jorisdg avatar kartikkr11 avatar leeparrishmsft avatar lesaltzm avatar lucgenetier avatar malekire avatar microsoftopensource avatar mikestall avatar mitugm14 avatar nguhoa avatar rick-nguyen avatar robulane avatar sagarbakliwal avatar shpakh-msft avatar toshio-msft avatar vamsimodem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

power-fx's Issues

Mid() function can hang interpreter

The interpret hangs on this expression:
Mid(Text(1/0, "#.000"), 1)

Looks like hangs is in here:

    private static IEnumerable<FormulaValue> MidFunctionExpandArgs(IRContext irContext, IEnumerable<FormulaValue> args)
    {
        var res = new List<FormulaValue>(args);
        while (res.Count < 3)
        {
            // The third argument to Mid can only ever be used if the first argument is a string
            if (args.First() is StringValue stringValue) <-- arg is ErrorValue, so we loop forever.
            {
                var count = new NumberValue(IRContext.NotInSource(FormulaType.Number), stringValue.Value.Length);
                res.Add(count);
            }
        }

        return res.ToArray();
    }

Exception in DevContainer

When I try to run the notebook in Dev Containers or Codespaces, I get the exception below.

Error: System.TypeInitializationException: The type initializer for 'Microsoft.PowerFx.Core.Texl.BuiltinFunctionsCore' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'Microsoft.PowerFx.Core.Types.Enums.EnumStore' threw an exception.
 ---> System.ArgumentException: currentLocale
   at Microsoft.PowerFx.Core.Utils.Contracts.CheckNonEmpty(String s, String paramName)
   at Microsoft.PowerFx.Core.Localization.StringResources.TryGet(String resourceKey, String& resourceValue, String locale)
   at Microsoft.PowerFx.Core.Localization.StringResources.Get(String resourceKey, String locale)
   at Microsoft.PowerFx.Core.Utils.LanguageConstants.get_SortOrderEnumString()
   at Microsoft.PowerFx.Core.Types.Enums.EnumStore..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.PowerFx.Core.Types.Enums.EnumStore.get_EnumSpec()
   at Microsoft.PowerFx.Core.Types.Enums.EnumStore.TryGetEnumSpec(String name, String& dType)
   at Microsoft.PowerFx.Core.Types.Enums.EnumStore.GetEnum(String name)
   at Microsoft.PowerFx.Core.Types.ErrorType.get_ReifiedErrorSchema()
   at Microsoft.PowerFx.Core.Types.ErrorType.ReifiedError()
   at Microsoft.PowerFx.Core.Texl.Builtins.IfErrorFunction..ctor()
   at Microsoft.PowerFx.Core.Texl.BuiltinFunctionsCore..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.PowerFx.Core.Texl.BuiltinFunctionsCore.get_BuiltinFunctionsLibrary()
   at Microsoft.PowerFx.Core.Glue.SimpleResolver..ctor(TexlFunction[] extraFunctions)
   at Microsoft.PowerFx.Core.Glue.SimpleResolver..ctor(IEnumerable`1 enumSymbols, TexlFunction[] extraFunctions)
   at Microsoft.PowerFx.RecalcEngineResolver..ctor(RecalcEngine parent, RecordType parameters, IEnumerable`1 enumSymbols, TexlFunction[] extraFunctions)
   at Microsoft.PowerFx.RecalcEngine.CheckInternal(String expressionText, FormulaType parameterType, Boolean intellisense)
   at Microsoft.PowerFx.RecalcEngine.Check(String expressionText, FormulaType parameterType)
   at Microsoft.PowerFx.RecalcEngine.Eval(String expressionText, RecordValue parameters)
   at PowerFxDotnetInteractive.PowerFxExpression.EvaluateSingleExpression(String originalExpression, String expression)
   at PowerFxDotnetInteractive.PowerFxExpression.Evaluate()
   at PowerFxDotnetInteractive.PowerFxKernel.HandleAsync(SubmitCode code, KernelInvocationContext context)
   at Microsoft.DotNet.Interactive.Kernel.HandleAsync(KernelCommand command, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\Kernel.cs:line 257
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<BuildPipeline>b__6_0(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation _) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 57
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_1.<<BuildPipeline>b__3>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 73
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.CompositeKernel.LoadExtensions(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation next) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\CompositeKernel.cs:line 144
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.<>c__DisplayClass6_0.<<BuildPipeline>g__Combine|2>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 74
--- End of stack trace from previous location ---
   at Microsoft.DotNet.Interactive.KernelCommandPipeline.SendAsync(KernelCommand command, KernelInvocationContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 48

It seems to be something to do with Culture. I tried to set DOTNET_SYSTEM_GLOBALIZATION_INVARIANT to false and also install libicu-dev (as per https://andrewlock.net/dotnet-core-docker-and-cultures-solving-culture-issues-porting-a-net-core-app-from-windows-to-linux/), but it doesn't seem to fix it.

My Dev Container config is in https://github.com/rajyraman/Power-Fx-.NET-Interactive

Implement Power FX for Power Platform Calculated Columns

Currently Calculated Columns only offer a very small subset of the functions available to canvas apps. Ideally they would support the full array of functions available, but in this issue I can only give the concrete example I've run into:

Problem: Calculate the number of days from today to some date, called StartDate
Formula listed in MSDN: DiffDays(StartDate, NOW())
Error: NOW() returns a DateTime, while StartDate returns a Date, DiffDays is unable to resolve these different types

Possible solutions, using Power FX formulas:

  1. Use the TODAY() method instead of NOW() so both data types are Dates
  2. Use one of the various methods available to either:
    a. Create a DateTime object from StartDate
    b. Create a Date object from NOW()

Note: None of the methods mentioned above are currently available in calculated columns

Hostability in .net

I've been generally uninterested in the power platform since from what i understand, it's only available as a hosted product from microsoft, meaning that any apps written in it is locked in to online use/hosting with Microsoft. This is absolutely fine for some projects mind you, just not something that has been applicable to the things i'm working on

However from what i understand Powerfx will eventually be open source and available to any application. will it be hostable inside a .net app for example? What about language services, for statement completion and syntax highlighting, will that also be available? WIll a host application be able to get an AST (similar to roslyn for example) to analyze the Powerfx code?

I can see Powerfx as a useful tool to expose some high level query functionality in our internal apps,

Async IPowerFxScopeFactory

Hi

We currently need to do some async stuff to populate a RecalcEngineScope
So when using the IPowerFxScopeFactory we need to re-synchronise task to respect GetOrCreateInstance method.

It would be nice to have a GetOrCreateInstanceAsync method, to avoid sync over async

Thank you

function call optimization

Some functional languages with immutable data support an optimization where a function calls with identical arguments will only be called once and the return value is cached.

Is that currently a feature of Power-fx? Or is it planned?

LSP should take an ILogger

LanguageServer ctor should take a logger callback object so that hosts can log exceptions callstacks coming from this try-catch:

LSP will catch and convert to a proper error message for the client, but the host may still need to get a notification and log a callstack to telemetry.

LSP is special here because it handles messages asynchronously. Whereas most others can throw an exception from their callstack and host will just catch it.

See if we can use https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.ilogger?view=dotnet-plat-ext-6.0

Error Message Improvements

This is a list of error messages that should be made clearer:

  • Unexpected characters. Characters are used in the formula in an unexpected way
  • Invalid use of '.'

Relation to DAX

DAX is another Excel-like Language of MSFT, used in Power BI.
How do these two Languages relate to each other? Please document this

Maybe a list of all Power-Platform / BI Languages and their scope would be helpful as well.

`Concatenate` issues

I have the following expression:

Concatenate("Hello", " World!")

However, as simple as it looks I do not get the expected result. This is the exception I am encountering:

System.InvalidOperationException: Errors: Error 19-20: Unexpected characters. The formula contains 'ParenClose' where 'Error' is expected.
Error 19-20: Unexpected characters. Characters are used in the formula in an unexpected way.
   at Microsoft.PowerFx.Core.Public.CheckResult.ThrowOnErrors()
   at Microsoft.PowerFx.RecalcEngine.Eval(String expressionText, RecordValue parameters)
   ...

And my code is nothing special:

var defaultCulture = CultureInfo.CreateSpecificCulture("en");
var engine = new RecalcEngine(defaultCulture);
var result = engine.Eval(formula, contextRecord);

I would appreciate your help!

DateDiff fails when TimeUnit enum prefix is missing

DateDiff examples from the official docs like this one fail:

DateDiff(Now(), DateValue("1/1/2014"), Months)

They only work if TimeUnit. is prefixed to the unit, so this works fine:

DateDiff(Now(), DateValue("1/1/2014"), TimeUnit.Months)

Since the official docs are in the non-prefix format, should this be fixed in the parser?

Project architecture

Hello,

I'm very existed about this project! Thank you!

I'm wondering if this the only language spec is open sourced or an entire platform? To re-phrase it will be possible to use Power-Fx in self-hosted apps which doesn't use Power Platform at all?

Improve alt text in images

The images in the documentation don't have descriptive alternative text. For example, in the overview document, what I believe screenshots are provided. The images were text is writen and where that text is meaningful should have the alt attribute set to that text rather than a generic description, or the image should be substituted by the text. I haven't looked much in the documentation, but maybe there are images where information which is not text is not correctly conveyed for a blind user through the alt attribute.

(The alt attribute is set between the exclamation point and the closing square bracket)

Operator Precedence

The documentation does not contain any information on operator precedence. Are all operators the same precedence?

Internal access needed to use option sets, issue converting `DType` -> `FormulaType`

  1. Internal access needs to be used to access the IExternalOptionSet used in a particular formula type value through DType.
  2. When converting DType to FormulaType in FormulaType.Build, the code below is dropping the IExternalOptionSet information, which effectively renders it unusable.
  // FormulaType.cs -> FormulaType.Build 
  case DKind.OptionSetValue:
      {
          bool? flag = type.OptionSetInfo?.IsBooleanValued;
          if (!flag.HasValue || !flag.Value)
          {
              return OptionSetValue; // <---- IExternalOptionSet is not passed in here.
          }

          return Boolean;
      }

The request here is to expose public IExternalOptionSet information on the OptionSetValueType. The minimum necessary to avoid using DType in PVA is to expose the entity name as a string and propagate it in the above code.

Language improvement for "Coalesce(..)"

First of all, I'm a ProDeveloper and ❤ PowerApps and it's language.

Therefore I would like to have a notation for the Coalesce(...) statement like:

value1 ?? value2 ?? value3 ?? ... in addition to Coalesce(value1, value2, value3, ...)

This would be similar to the notation of condition1 || condition2.

Where is source code? Compiler? Linker? Parser?

What i can only see , it is just some document.
But as programming language. said open source, Where is the source code.

Or why you called it Open Source.

Am i wrong to understand what is the opensource.

Hey , I am happy to open source Power-FX (But only the document open source)

How did you feel like it ?

Unable to debug using sourcelink

When I try to use LanguageServer, I am getting -32602 (InvalidParams) error. So, I would like to Debug using Source Link. When I step through to Power Fx code, I get the error below.

image

Please update the Source Link information for the assemblies published on Nuget. If I ignore the warning and use the LanguageServer file on my local machine, the debug is all messed up and I am unable to step through properly.

LookUp support

Hello, I am experimenting with this library and encountered the following problem:
This is my code:

var expression = "LookUp(Settings, Name = \"Client\")";
var engine = new RecalcEngine();
var parameters = FormulaValue.RecordFromFields(
    new NamedValue("Settings",
        FormulaValue.TableFromRecords(
            FormulaValue.RecordFromFields(new NamedValue("Name", FormulaValue.New("Client"))),
            FormulaValue.RecordFromFields(new NamedValue("Name", FormulaValue.New("Test"))))));
var result = engine.Eval(expression, parameters);

I expect that this expression will be evaluated correctly and will return only the first table record (the name of which is exactly "Client"). But instead an exception is thrown. This is its message:

Errors: Error 0-33: Invocation of unknown or unsupported function.
Error 17-21: Name isn't valid. This identifier isn't recognized.
Error 22-23: Incompatible types for comparison. These types can't be compared: Error, Text.

I found that in your BuiltInFunctionsCore file there are public static readonly fields for each built-in function but the LookUp and Search are missing. Maybe this is one reason for this behavior?

Missing Unary Negate

The unary negate seems to work in Power Apps:

image

There is no unary negation in the expression grammar.

Open source timeline?

The overview for Power-Fx states:

Power Fx will be made available as open-source software. It's currently integrated into canvas apps, where you can experience it today. We're in the process of extracting it from Power Apps for use in other Microsoft Power Platform products and as open source. More information: Microsoft Power Fx on GitHub

https://docs.microsoft.com/en-us/power-platform/power-fx/overview

I have questions

  • Is there a timeline for this?
  • Which OSS licence?

I note F# and VSC are MIT-licenced and TypeScript is Apache2

Firebase data source

Is there any chance to connect, - even in the future, my power apps to my firebase datas?

Filter should be able to handle empty rows

These expressions should return a table with 5 elements. Today they don't (the first one does not work, the second one removes the empty record):

  • Filter(Table({a:1},{a:2},If(1<0,{a:3}),{a:4},{a:5}), true)
  • Filter(Table({a:1},{a:2},If(1<0,{a:3}),{a:4},{a:5}), IsBlank(a) Or a > 0)

Choice option is not updated in Power Fx (in Command Bar editor)

When using the Power Fx formula to set the visibility of a Command (in the new Command Bar editor), I realized that a newly added option in the Choice did not show up in Formula bar. Even after I have published all the customization. The option is visible in the Custom Page formula bar. Please see the attached screenshot below.
image
image
image

Way to Retrieve all Formulas from RecalcEngine

I may have missed something, but there doesn't appear to be a way to get a list of all defined formulas/variables back from the RecalcEngine. I see that the value can be retrieved if you have the name, but this would require the PowerFx-consuming application to remember the names of all formulas/variables.

I believe this would be useful for many reasons, but the two initial use cases I've come across that couldn't be addressed due to this missing are:

  • Showing the user everything currently defined, so they don't need to remember everything they've set so far
  • Dumping all formula values, serializing them, saving them somewhere persistent, and later retrieving + redefining the formulas so that a user can resume their "session" from much earlier without needing to keep RecalcEngine alive the entire time

Operators and separators shouldn't be region dependent

I wrote a whole rant on some things that I didn't like in Power Apps in dev.to. But I'll try to keep it civil here.

https://github.com/microsoft/Power-Fx/blob/main/docs/global.md#formula-separators-and-chaining-operator this makes no sense.

1 - It fools seasoned programmers and our conventions
2 - it fools newcomers in thinking that ye old copy/paste from the internet solution will work for them, making forums less useful and friendly
3 - Its not "Think Excel". Excel lets you change separators independent of where you are in the world.
4 - In some regions, it just makes the code look ugly (eg.: ;;)
5 - Documentation in docs.microsoft.com is not localized (yet). This creates confusion.

One solution is to get rid of this localization system all together and follow a nice standard.
The other is to see follow item 3 and just let developers choose what format to use.

Incorrect Source-Span for lambda/LazyEval nodes

When I try to get the source span(in-order to get a string representation) for a lambda (Eg: a > b in CountIf(TestTable, a > b), The source context for the lambda is 0-Length of formula. Is this by design?

In file IRTranslator.cs (Line 271):

args.Add(new LazyEvalNode(context.GetIRContext(node), child));

The IRContext of the current node is passed in instead of the current arg ( var arg = node.Args.Children[i];). Passing in arg gives the corrext source span.

Recursive type marshalling

  1. Recursive types.
  2. Deferred type marshalling. If a type has 700 fields, but we only use 2, would be ideal to not have to import fields we don't use.

In the same way that RecordValue has a virtual GetField, it would be nice if RecordType had some virtuals.

Will you make Power-Fx work for real?

You say Power-Fx is based on the formulas in Excel and that makes me worried since the formulas in Excel can't even handle very basic tasks. Also Excel formulas don't work very well outside US when it comes to how they handle regional and localized data formats.
Power Automation is so bad and unproductive to work with today, that it goes faster to set up a webserver and just write C# code to do whatever it is you need doing.
The reason for this is the lack of some of the most basic things you need when dealing with data, just try to parse a date/time from a string, or manipulate a file path.

  1. Will Power-Fx be able to handle non US dates and times?
    (just search for: "excel international regional date time problem" and you will see the problems excel has dealing with this some of them have been around for 20+ years and are still not solved)
  2. Will you make sure that the whole eco-system fits together and work as one unit, or will ju just do your "functions" and then ignore if they work or not with what other parts/teams at Microsoft develop?
    (try to use the date of a received email with the date functions to get UTC-time and you will understand what I mean)
  3. Will it be possible to split a string on newlines?
    (had a support case with the Office-365 support for PowerAutomate where they finally said it was not possible since there was no way escape characters in a string or in any other way create "\n")
  4. Will it be possible to evaluate/run the functions at design time, or will you need to actually submit/save the function and actually run the entire "solution" in order to see the result?
  5. Will you be able to write your Power-Fx functions in VisualStudio and make them part of your solution and version control?
  6. Will there be support for staging/testing environments?
  7. Will there be support for accessing a common configuration repository, shared between all resources in Azure?
  8. Will there be support for extending Power-Fx with your own custom made C# functions?
  9. How will error handling work?
  10. Will there be support for regular expressions?
  11. You are aware of that the users can have English Windows with the regional settings set to something completely different, right? So you are not trying to get internationalization and regional stuff working with only the language setting in the browser, right?
    You do realize you need at the very least two settings to get this correct, and even then (with two settings) you will not be able to handle all the customizations a user can do to the regional settings in Windows.
    And even then you need to be able to set which culture should be used for a specific function, it will not work to just use whatever settings the current user might have, because you never know where the data is going next.

Expose formula parser

Hi,
I'd like to parse the formula before executing it :

Use case:

  • In a grid with available columns A, B, C, D, user choose to display A, B
  • Application execute SQL query to populate grid:
    SELECT A, B FROM MyTable
  • Now we want to let user create custom columns, powered by PowerFx
  • User defines column F = ThisItem.C & ThisItem.D
  • User chooses to display A, B, F

Here we need to parse formula F to know we need to query C, D from DB
=> SELECT A, B, C, D FROM MyTable

Is there any way to achieve this ?
Could we expose the formula parser to retrieve used fields ?

Thank you

Feature request: Relative date options

I'm not sure if this is the place for this, but I don't know where else to put it!

I've been a fan of Moment.js for years. It's a library that you can use for various date calculations/formatting in different languages. Now, Power Fx handles calculations & formatting pretty well. There's only one thing missing to me: relative dates. I would love Power Fx to have that as well (without a lot of formula usage...).

I would love to see some formula or extra formula where we can input a date and then it will calculate how long that's from the current date: 1 hour ago, 2 days ago, in 2 days, in 2 hours, etc.

Is this an option for Power Fx?

Sample for Host Integration incl custom functions.

Many of us build LOB no-code platforms. Can we have a sample showing how to integrate the open sourced libraries into our products, especially:

  • Hosting the interpreter
  • How to load custom functions
  • How to provide custom variable / value providers (like a sheet references or object trees etc)

This libraries look awesome!


tl;dr: The team meanwhile update the README with a link to the samples

Async functions

Awesome job!

Will Power-Fx support asynchronous functions?

`Concat` implementation doesn't offer separator optional argument

This implementation of the Concat function doesn't accept the optional "Separator" argument specified in the documentation/that exists in Power Apps:

public static FormulaValue Concat(EvalVisitor runner, SymbolContext symbolContext, IRContext irContext, FormulaValue[] args)
{// Streaming
var arg0 = (TableValue)args[0];
var arg1 = (LambdaFormulaValue)args[1];
StringBuilder sb = new StringBuilder();
foreach (var row in arg0.Rows)
{
if (row.IsValue)
{
var childContext = symbolContext.WithScopeValues(row.Value);
// Filter evals to a boolean
var result = arg1.Eval(runner, childContext);
var str = (StringValue)result;
sb.Append(str.Value);
}
}
return new StringValue(irContext, sb.ToString());
}

It looks like this is related to the general implementation of functions with optional arguments/multiple different sets of arguments, inspecting the implementation of some of the aggregate numerical functions like Average:

{
BuiltinFunctionsCore.Average,
StandardErrorHandling<FormulaValue>(
expandArguments: NoArgExpansion,
replaceBlankValues: DoNotReplaceBlank,
checkRuntimeTypes: ExactValueTypeOrBlank<NumberValue>,
checkRuntimeValues: FiniteChecker,
returnBehavior: ReturnBehavior.AlwaysEvaluateAndReturnResult,
targetFunction: Average
)
},
{
BuiltinFunctionsCore.AverageT,
StandardErrorHandling<FormulaValue>(
expandArguments: NoArgExpansion,
replaceBlankValues: DoNotReplaceBlank,
checkRuntimeTypes: ExactSequence(
ExactValueTypeOrBlank<TableValue>,
ExactValueTypeOrBlank<LambdaFormulaValue>
),
checkRuntimeValues: DeferRuntimeValueChecking,
returnBehavior: ReturnBehavior.ReturnBlankIfAnyArgIsBlank,
targetFunction: AverageTable
)
},

So, perhaps this issue can be used to track improvements to the function dispatch implementation? (Would this be multiple dispatch?)

Request for ShowColumns

ShowColumns is not yet implemented. it is a priority for my project, should that affect the roadmap.

Requirements?

What are the requirements for using/working on PowerFx? Windows, or does it work on macOS?

Also, is this being continued, or was it just a PoC and paid, hosted PowerApps is taking over as how PowerFx will move forward?

Better Support for n-D Array Formulas

Excel has upto 3D array formulas. Power Fx also should have the notion of an n-D array which can contain a mix of other variables, arrays or array slices and tables or table slices.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.