Start a new topic

How to query for bool value?

Kinda a stupid question so hopefully a easy answer. So I have a bool value stored in the database of true and false. Keep in mind this is really true and false not a string or a int.

When I use the query on field function I am having trouble figuring out what to use to make sure it looks for true. See code below.

KCSQuery *onHomeScreen = [KCSQuery queryOnField:@"showChannelOnHomeScreen" withExactMatchForValue:true];

So with this in mind, what do I need to put in place of "true." It complains it is not a object. Is there a object for a bool in iOS?

What is the "right" way to do this search.



Ummm after some digging found out that you can use a number. I think.

My solution turned out to be this:

KCSQuery *onHomeScreen = [KCSQuery queryOnField:@"showChannelOnHomeScreen" withExactMatchForValue:@YES];

Not sure if it is the "right" way to do it though.
Hey Sean, Your solution looks good to me, but I'll get an engineer to take a look in case there's another way.
Login or Signup to post a comment