aws-appsync-community icon indicating copy to clipboard operation
aws-appsync-community copied to clipboard

Feature Request: Support for VTL Sort Tool

Open dale-jepto opened this issue 6 years ago • 8 comments

I have seen several requests for this before on the Community Forums, but I can't see it here so wanted to make sure it was raised officially.

Support for this: https://velocity.apache.org/tools/devel/apidocs/org/apache/velocity/tools/generic/SortTool.html

Or ideally the whole range of tools: http://velocity.apache.org/tools/3.0/generic.html?

We are finding that a Query to DynamoDB will often not have the results sorted in the right format for the UI (IDs used in the sortKey but alphabetical sorting needed for the GUI). So from a performance aspect we assume that doing this via VTL and not client side JS will yield the best results.

dale-jepto avatar Jul 31 '19 22:07 dale-jepto

Thank you for the request. I'll make sure the team sees this as it's definitely a useful feature.

tinnou avatar Aug 02 '19 19:08 tinnou

Sorting in the resolver response template only works if your DynamoDB query returns all of the results. If you need to page through the results then it won't work. The best solution is to combine additional DynamoDB indexes and switching the index based on the sort attribute.

buggy avatar Aug 03 '19 11:08 buggy

Sorting in the resolver response template only works if your DynamoDB query returns all of the results. If you need to page through the results then it won't work. The best solution is to combine additional DynamoDB indexes and switching the index based on the sort attribute.

Adding another index won't help if you want to sort by an attribute from the query and not the sortKey itself. As sortKeys are often overloaded (like Rick Houlihan's v0 concept) or use some form of UUID, the only approach to sort the query results in a logical manner is via VTL or JS.

dale-jepto avatar Nov 21 '19 01:11 dale-jepto

Would be great to have this implemented, it will allow to push some of the business logic to VTL resolvers instead of invoking downstream lambda functions.

Dlozitskiy avatar Feb 12 '20 00:02 Dlozitskiy

Looking forward to this feature. There should be support for all VTL tools. I especially need to use the Math tool for simple min, max. https://velocity.apache.org/tools/3.0/tools-summary.html#MathTool

vanditamathur avatar Aug 17 '20 10:08 vanditamathur

sorting is available now in $util https://docs.aws.amazon.com/appsync/latest/devguide/resolver-util-reference.html#list-helpers-in-util-list

ahmed-anas avatar Oct 21 '21 16:10 ahmed-anas

Any news on this topic ?

acrolink avatar Oct 22 '23 19:10 acrolink

No news?

acrolink avatar May 05 '24 10:05 acrolink