2
    AWSDynamoDBObjectMapper *dynamoDBObjectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper];
    AWSDynamoDBScanExpression *scanExpression = [AWSDynamoDBScanExpression new];
    scanExpression.exclusiveStartKey = nil;
    scanExpression.limit = @20;
    [[[dynamoDBObjectMapper scan:[DDBTableRow class]
                      expression:scanExpression]
      continueWithExecutor:[BFExecutor mainThreadExecutor] withSuccessBlock:^id(BFTask *task) { ................

I am able to scan through and return the first 20 recorded from a specific table from my DynamoDB as shows on a piece of code above.

The question now is I want to add a scanExpression.scanFilter = property but I haven't find any good direction on how to build that. I am using AWSiOSSDKv2 aws sdk for iOS on xcode6

here is what I have so far. It is not complete yet:

    AWSDynamoDBCondition *condition = [AWSDynamoDBCondition new];
    AWSDynamoDBAttributeValue *attribute = [AWSDynamoDBAttributeValue new];
    attribute.N = @"400";
    condition.comparisonOperator = AWSDynamoDBComparisonOperatorEQ;

    NSDictionary *scanFilter = @{@"lat":
                                     @{@"AttributeValueList":attribute,
                                       @"ComparisonOperator":@1}
                                 };
    scanExpression.scanFilter = scanFilter;
shebelaw
  • 3,992
  • 6
  • 35
  • 48

1 Answers1

1

You can use it as follows:

AWSDynamoDBCondition *condition = [AWSDynamoDBCondition new];
AWSDynamoDBAttributeValue *attribute = [AWSDynamoDBAttributeValue new];
attribute.N = @"400";
condition.attributeValueList = @[attribute];
condition.comparisonOperator = AWSDynamoDBComparisonOperatorEQ;
scanExpression.scanFilter = @{@"lat": condition};
Yosuke
  • 3,759
  • 1
  • 11
  • 21
  • awesome!! the concept is out there but not specifically to Objective-c or to the V2 or the sdk – shebelaw Sep 11 '14 at 21:42
  • Any suggestion on what to do if I want to perform a scan using multiple parameters? `scanExpression.scanFilter = @{@"lat": condition, @"longitude":longitudeCondition};` is it correct way to do? – rohan-patel Aug 18 '15 at 04:47