Combining SharePoint and PowerApp can be quite powerful. But sometimes, there are still some things that are not behaving the way you should expect. A good example is the yes/no column.
The yes/no column in SharePoint is a boolean field, which is basically a choice field that can store two values: Yes or No:
When you request the items through REST, the values are shown as true or false:
https://<TENANT>.sharepoint.com/sites/<SITE>/_api/web/lists/GetByTitle('<LIST>')/items?$select=<FIELDS TO SHOW>
So, which value do we use in PowerApps? Let’s find out!
I created a simple PowerApp that shows all list items in a Data table, all items in a Gallery and a Gallery that will only shows items that has its ‘Show in PowerApps’ field set to ‘Yes’.
No filters have been applied yet, so all controls show all items. What we can see from this result is that the Data table shows a nice slider control for the Yes/no field. Unfortunately for me, I cannot detemine what value I should use in my filter based on this control. Luckily, the Gallery does: true or false. Easy isn’t it?!
Filter( PowerApps, 'Show in PowerApp' = true )
This does not give me the result I expect because I DON’T want that item to show in my PowerApp. Changing the value in my filter from true to false also doesn’t change anything, so it looks like I cannot use true or false in the PowerApp. How about Yes or No then?
Filter( PowerApps, 'Show in PowerApp' = 'Yes' )
Unfortunately, the same result. I even get a warning from PowerApps that my filter is incorrect:
Back to basics: a boolean field is Yes/No, true/false or 1/0, so what if I try the 1/0 option?
Still the same warning. I also cannot auto-format my function, because there is an error.
However, I saw the results in my Data table change after I changed the Filter and now it does only show the item I want to see:
So, even though PowerApps tells you the Filter is incorrect, it isn’t! Just be persistent and do not give in too easily