Skip to content

Behavior and non-behavior #818

Answered by anderson-joyle
cchannon asked this question in Q&A
Discussion options

You must be logged in to vote

A behavior function is a function that changes the value of a variable, or database table, or any other value that is somewhere previously stored. Most of Power Fx formulas (non-behavior) receive 0..N arguments, return a calculated value, and that's the end of it. The behavior function result, in the other hand, persists.
Currently there are mainly 4 behavior functions: Set, Collect, Patch, and Remove.
To enable the behavior functions, you got to explicitly "tell" the engine to. Please check the following test cases:
https://github.com/microsoft/Power-Fx/blob/main/src/tests/Microsoft.PowerFx.Interpreter.Tests/MutationFunctionsTests.cs

Take a closer look at these two lines:

line 29
private…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@cchannon
Comment options

@anderson-joyle
Comment options

Answer selected by cchannon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants