Skip to content

Deleting Rows

cmancushman edited this page Oct 26, 2017 · 2 revisions

Rows and Conditions

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.


Delete a Row That Satisfies a StackBaseCondition

Declaration

-(void)deleteRowsThatSatisfyTheCondition:(StackBaseCondition *)condition completionBlock:(StackBaseEditCompletion) compBlock;

Example

[weakSelf.table deleteRowsThatSatisfyTheCondition:[StackBaseCondition columnWithName:@"id" isEqualTo:@3] 
completionBlock:^(BOOL success, NSString *responseMessage) {
    
    if(success){
        
        NSLog(@"Update Successful.");
        
    }else{
        
        NSLog(@"Update Unsuccessful: %@", responseMessage);
        
    }
    
}];

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.


Delete All Rows

Declaration

-(void)deleteAllRowsWithCompletionBlock:(StackBaseEditCompletion) compBlock;

Example

[weakSelf.table deleteAllRowsWithCompletionBlock:^(BOOL success, NSString *responseMessage) {
    
    if(success){
        
        NSLog(@"Operation Successful.");
        
    }else{
        
        NSLog(@"Operation Unsuccessful %@", responseMessage);
        
    }
    
    
}];

Clone this wiki locally