There is a well known "bug" when working with SharePoint list Yes/No column :
The Yes/No value can not be compare to boolean type true/false.
Filter(SPList,YesNoColumn = true) will not return all the items with a Yes value .
The workaround is to use 1 or 0:
Filter(SPList,YesNoColumn = 1)
This will return all items with a true value, but the designer shows an error because we are comparing a boolean to a number.
It would be great to fixe that, as a Yes/No column is indeed a boolean value, we need to be able to compare that to a boolean value in PowerApps.
Apologies resetting this status. Adding @GregLi and @Emma to update with accurate status. Both TopShelf ad Audrie-MSFT are not longer able to provide an update for Power Apps ideas. @GregLi & @Emma please provide inputs and/or comments. Thank you.
I just ran into this today and then did some digging to find this was discovered and reported over a year ago...can't believe it's not fixed yet. 1/0 seems to work the best for me. Hoping, this will be fixed soon.
After much headbashing I finally ran across this post.
Filter(SPList,YesNoColumn = 1) is what did the trick for me.
Thanks for explaining this and saving further headache 🙂
Filter(SPList,YesNoColumn = 1) as well as Filter(SPList,YesNoColumn <> false) are NOT delegable. This should be fixed immediately.
I always find that resorting back to text helps get around things. I tried in this case the following:
and that gave me what I needed. Of cuorse the complaint was a delegation warning. Not an issue in my case, but to clear that, I went with:
Filter(AddColumns(SPList, "txtYesNoColumn", Text(YesNoColumn)), txtYesNoColumn="true")
That cleared up the warning and worked just as well.And, if the new column tricks up things then I went with this little charm:
DropColumns(Filter(AddColumns(SPList, "txtYesNoColumn", Text(YesNoColumn)), txtYesNoColumn="true"), "txtYesNoColumn")
The AddColumn function cannot be delegated. The warning has disappeared but the problem is still there. You create a column only for the 500 first items of the list so your filter output is incomplete.
@tchin-ninyes totally agree on the delegation part, and mentioned that was not so much an issue in our cases, but yes, it is a factor.
I have also found that filtering on the opposite will provide accurate results.
Ex: Filter(dataSource, YesNoColumn<>true) for when you want "no" fields
and Filter(dataSource, YesNoColumn<>false) for when you want "yes" fields.
These example return accurate results at least.
However again...delegation issue.
The only workaround I know of for that, right now, is to go to the data source and create a calculated numeric column based on the value of the Yes/No column. Numeric columns are delegable.
This is a no-brainer, why isn't this fixed yet?
@RandyHayes This worked for me, Thank you!
Need it to work!
I ran into this issue today!So weird that the filter works well in one screen and fails to work in another screen or any other newly created application.
All above-suggested workarounds do the trick! But, delegation issue persists with all workarounds.
Starting to wonder if any preview features are causing this issue!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.