Skip to content

Updating Rows

cmancushman edited this page Oct 26, 2017 · 3 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.


Update Rows That Satisfy a StackBaseCondition

Declaration

-(void)updateRowsThatSatisfyTheCondition:(StackBaseCondition *)condition withFieldsAndValues:(NSDictionary *)fieldsAndValues completionBlock:(StackBaseEditCompletion) compBlock;

Example

[weakSelf.table updateRowsThatSatisfyTheCondition:[StackBaseCondition columnWithName:@"Name" isEqualTo:@"Sean"] 
withFieldsAndValues:@{@"Memo" : @"Hey Chris! This is my first memo. Am I doing this right?"} 
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.

Clone this wiki locally