srz2
srz2

Reputation: 162

DynamoDB: The attempted filter operation is not supported for the provided filter argument count

I am working with the iOS SDK with the Amazon Web Services

I am trying to make a scan request with code below:

DynamoDBScanRequest *request = [[DynamoDBScanRequest alloc] initWithTableName:self.tableName];
DynamoDBCondition *condition = [[DynamoDBCondition alloc] init];
[condition setComparisonOperator:@"GT"];
NSString *key = [[alertView textFieldAtIndex:0] text];    //Returns NSString @"00610"

[request setScanFilterValue:condition forKey:key];

DynamoDBScanResponse *response = [self.dbClient scan:request];

I get this error:

The attempted filter operation is not supported for the provided filter argument count

Please someone help explain what is going on!!!!

Upvotes: 4

Views: 980

Answers (1)

Cory Kendall
Cory Kendall

Reputation: 7304

Conditions require a specific-size AttributeValueList for the Condition name based on the name of the Condition; this error means you tried to use GT (greater-than) with the wrong number of attributeValues. Greater-than requires 1 attribute value, so possibly you are providing 0, or 2.

Here are the other Conditions, and the number of attribute values they require:

NOT_NULL     0  (exists)
NULL         0  (not exists)
EQ           1  (equal) 
NE           1  (not equal)
IN           1  (exact matches)
LE           1  (less than or equal to)
LT           1  (less than)
GE           1  (greater than or equal to)
GT           1  (greater than)
CONTAINS     1  (substring or value in a set)
NOT_CONTAINS 1  (absence of a substring or absence of a value in a set)
BEGINS_WITH  1  (a substring prefix)
BETWEEN      2  (between)

Upvotes: 2

Related Questions