REPL: [pac pfx] Add Support for inserting records with Patch and Defaults
Currently, if you use the following Power Fx with pac pfx:
Patch(Accounts,
Defaults(Accounts),
{
'Account Name':"Test"
}
);
It will fail with the error 'Defaults' is a recognized but not supported function.
This is not surprising since Defaults is not listed as a supported function at https://aka.ms/Power-Fx-PAC-CLI
If you omit the Defaults, then it gives the error Error 0-57: Invalid number of arguments: received 2, expected 3 or more.
The work around is to use Collect instead, however folks are mostly used to using Patch with Defaults as described by https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-patch#overview
Can support for Inserting records using Patch and Defaults be added?
We have https://github.com/microsoft/Power-Fx/issues/1550 under development which will unify Collect/Patch/Clear/ClearCollect functions with the Power Apps overloads. No ETA.
Hi @anderson-joyle, any update on the ETA to support Patches and Defaults? Thanks
Hi @anderson-joyle, any update on the ETA to support Patches and Defaults? Thanks
The Patch function has all overloads available in Power Fx. Not sure if the changes made their way to PAC. I'll check and let you know.
Defaults is still not available. There's no ETA right now. I'll push some internal conversations.
The work around is to use Collect instead
Thanks, I've just come up against this as Patch seems to be the natural way to do it and using Patch with Default is the way described in the docs. It would make using the library and CLI more straightforward if Defaults could be added, but failing that could a note be added to the Patch and Defaults docs to indicate that Collect is the preferred way of creating a record?