4
Views
0
Comments
[Amazon DynamoDB Connector] Optional ProjectionExpression, FilterExpression and Select parameters
amazon-dynamodb-connector
Service icon
Forge asset by Guilherme Pereira
Application Type
Service

Hi,

The Query server action has input parameters ProjectionExpression, FilterExpression and Select which are supposed to be optional according to the Amazon DynamoDB .NET SDK.

However, as OutSystems doesn't support null values, when left empty, these are sent to the AmazonDynamoDB SDK as empty strings, and then you get an exception that these cannot be empty.

If not used, the SDK expects these to be sent as null, not "".

Therefore I've made this change in the extension, to pass these as null if empty (change is in bold):

public void MssDynamoDB_Query(string ssTableName, string ssKeyConditionExpression, string ssExpressionAttributeNames, string ssFilterExpression, string ssExpressionAttributeValues, string ssProjectionExpression, string ssSelect, out string ssItems) {

            Dictionary expressionAttributeNames = JsonConvert.DeserializeObject>(ssExpressionAttributeNames);

            Dictionary expressionAttributeValues = JsonConvert.DeserializeObject>(ssExpressionAttributeValues);

            List> items = AmazonDynamoDB.Instance.Query(ssTableName, ssKeyConditionExpression, expressionAttributeNames, expressionAttributeValues, ssProjectionExpression != "" ? ssProjectionExpression : null, ssSelect != "" ? ssSelect: null, ssFilterExpression != "" ? ssFilterExpression: null);

            ssItems = JsonConvert.SerializeObject(items);            

} // MssDynamoDB_Query


Can you please apply this change to the extension?

Kind regards,

Steven

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.