-
Notifications
You must be signed in to change notification settings - Fork 0
Retrieving Rows
cmancushman edited this page Oct 26, 2017
·
6 revisions
When querying for rows, StackBaseCondition objects are often used to help refine results. To understand these better, take a look at the docs for StackBaseCondition.
Declarations
-(void)getFirst:(NSInteger )numberOfRows rowsWithCompletionBlock:(StackBaseQueryCompletion) compBlock;-(void)getFirst:(NSInteger )numberOfRows rowsWhere:(StackBaseCondition *)condition completionBlock:(StackBaseQueryCompletion) compBlock;Example
[weakSelf.table getFirst:3
rowsWhere:[StackBaseCondition columnWithName:@"id" isGreaterThan:@10]
completionBlock:^(BOOL success, NSString *responseMessage, NSArray<NSDictionary *> *responseTable) {
for(NSDictionary *row in responseTable){
NSLog(@"row %ld: %@", ([responseTable indexOfObject:row] + 1), row);
}
}];Declarations
-(void)getFirst:(NSInteger )numberOfRows rowsStartingAtRow:(NSInteger)startingRow completionBlock:(StackBaseQueryCompletion) compBlock;-(void)getFirst:(NSInteger )numberOfRows rowsWhere:(StackBaseCondition *)condition startingAtRow:(NSInteger)startingRow completionBlock:(StackBaseQueryCompletion) compBlock;Example
[weakSelf.table getFirst:3
rowsWhere:[StackBaseCondition columnWithName:@"id" isGreaterThan:@10]
startingAtRow:5
completionBlock:^(BOOL success, NSString *responseMessage, NSArray<NSDictionary *> *responseTable) {
for(NSDictionary *row in responseTable){
NSLog(@"row %ld: %@", ([responseTable indexOfObject:row] + 1), row);
}
}];Note
When passing numeric values into rows (@"example_numeric_field" : @4) or conditions ([StackBaseCondition columnWithName:@"id" isEqualTo:@1]), the numbers must be formatted as NSNumbers or be prefixed with '@' in order to be processed by the backend.
Intro
Managing Tables
Managing Columns
Managing Rows
Conditions
Going Forward