-
I encountered a feature in Power Apps formula's and I hope you guys can help me. Why does the following formula
return a record with only the common field which is available on both records?
Is this behaviour documented somewhere? Where can I find more info about this behaviour? It looks like a common schema for the records is determined, causing non-common fields to be dropped from the resulting record... I also asked this question in the Power Apps forum: https://powerusers.microsoft.com/t5/Building-Power-Apps/Why-should-records-in-an-If-formula-have-the-same-fields/m-p/1576980#M404957 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Update: |
Beta Was this translation helpful? Give feedback.
-
Here's the pointer to the code that determines the type of an If() ... Along with some unit tests: If()'s resulting type is basically an intersection of the true and false branches - It doesn't know until runtime which branch will actually be, so the intersection is a safe set that will work on both the true and false branch. |
Beta Was this translation helpful? Give feedback.
Here's the pointer to the code that determines the type of an If() ...
Power-Fx/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/If.cs
Line 63 in 28050c0
Along with some unit tests:
https://github.com/microsoft/Power-Fx/blob/main/src/tests/Microsoft.PowerFx.Core.Tests/ExpressionTestCases/If.txt
If()'s resulting type is basically an intersection of the true and false branches - It doesn't know until runtime which branch will actually be, so the intersection is a safe set that will…