Hi,
I have a simple Sharepoint list with a number of fields. One of those fields is a Yes/No field called "Managed" (default value: No)
If I try to use this code inside the Items field in a gallery component for my app:
SortByColumns(
Filter(
[@'My List'];
Or(
Radio_choice.Selected.Value = "All"
;And(Radio_choice.Selected.Value = "Not managed"; ThisRecord.Managed = false)
;And(Radio_choice.Selected.Value = "Managed"; ThisRecord.Managed = true)
)
)
;"Managed"
;SortOrder.Ascending
;"Title"
;If(SortDescending1; SortOrder.Descending; SortOrder.Ascending)
)
When I click on the "managed" radio buton option, the filter does not work (it shows records with both false and true values. The other options ("All", "Not managed") work fine.
However, If I make this simple change to the code:
... And(Radio_choice.Selected.Value = "Managed"; ThisRecord.Managed = 1)
It works as expected. The funny part is that the changed code is being correctly reported as a type mismatch error (comparing Number with Boolean), but it still works regardless.
My question is: why does the "wrong" code actually work, instead of the semantically correct one?
Edit: Please note that I can't use the alternative ThisRecord.Managed<>false (which works, by the way) or similar, as it would incur into a delegation warning message.