Start a new topic

Query Using KKCSAND

Hi All, i'm writing a code for joining two queries and keeping conditional operator as KKCSAND but the result is nil. can u please help me from this. whether i'm doing right or wrong. here is my small snippest code. i want to match a collection with room id and floorid. if it is matched means then i'm trying to get entire row. but it is showing null.. can u please help me from this.

KCSQuery *query1 = [KCSQuery queryOnField:@"room_id" withExactMatchForValue:@"1"];

KCSQuery *query2 = [KCSQuery queryOnField:@"floor_id" withExactMatchForValue:@"0"];

KCSQuery *combinedQuery = [KCSQuery queryForJoiningOperator:kKCSAnd onQueries:query1,query2, nil];

[collectionStore queryWithQuery:combinedQuery withCompletionBlock:^(NSArray *objectsOrNil, NSError *errorOrNil) {


But object retuns nil.

Good morning Harish,

In this case I'm not entirely sure that combinedQuery is what you're looking for, I think addQuery may provide you with the result that you're looking for.

You can read documentation around compound queries here:

Your updated source code might look like this:

KCSQuery *query1 = [KCSQuery queryOnField:@"room_id" withExactMatchForValue:@"1"];

query1[addQuery:[KCSQuery queryOnField:@"floor_id" withExactMatchForValue:@"0"]] ;

[collectionStore queryWithQuery:query1 withCompletionBlock:^(NSArray *objectsOrNil, NSError *errorOrNil) {



Did this answer your question?

Hi Damien first of all thank you for replying to my question. but i solved it in another Way. Thanks for your reply Damien
Login or Signup to post a comment