Questions tagged [vtl]

The Velocity Template Language (VTL) is meant to provide the easiest, simplest, and cleanest way to incorporate dynamic content in a web page.

VTL is the Velocity Template Language.

It includes Variables, Properties, Methods, Directives, Macros, and more...

Reference: http://velocity.apache.org/engine/2.0/vtl-reference.html

193 questions
0
votes
2 answers

Querying DynamoDB with multiple fields in an AppSync Resolver

I have a DynamoDB messages table with id, content, createdAt (int), userID fields. I can obtain a user's messages using below resolver: { "version" : "2017-02-28", "operation" : "Query", "index" : "userid-createdat-index", "query" :…
Kerem
  • 1,494
  • 2
  • 16
  • 27
0
votes
1 answer

What is the opposite of .contains for VTL?

I have the potential for two different outputs based on three additional attributes and the values they contain: #if($f3=="Banana" && $f2.contains("Mud")) This is gross #end Works just fine. However if I want to add in an #elseif to check for $f2…
0
votes
1 answer

Replace Line Break VTL

I need to replace all line breaks with a ^ character using VTL. I unfortunately do not know which version of VTL I am using as it is used as the formula language within an application. Please see below with what we have so far: #if($FIELD}…
0
votes
1 answer

How to execute a bulk ElasticSearch operation from an AppSync resolver?

I'm trying to execute a bulk operation over an ElasticSearch index from a VTL AppSync resolver. Specifically this mutation: input CreateTopicsInput { language: String! texts: [String!]! } type Mutation { createTopics(input:…
Ignacio
  • 331
  • 6
  • 15
0
votes
1 answer

How to escape apostrophe using VelocityTemplate

was hoping you could help me figure out the best way to escape an apostrophe (single-quote) in my VTL syntax. Here is what is working for all of my values that do not have an apostrophe. I have tried to add an additional apostrophe, and tried a…
0
votes
1 answer

How to correctly evaluate Velocity context?

I'm new to Apache Velocity and I would like to know what is the correct way of evaluating my context. Here is my situation: I'd like to open a .docx file used as template, replace some words in it with Apache Velocity and then save the result in a…
F. Malato
  • 192
  • 2
  • 15
0
votes
2 answers

velocity template loop through array to create string

I'm trying to use the velocity templating language in an AWS appsync resolver to create a string by looping through an array of characters. Given the array listOfWords = ["好" "克力"] how would I achieve the string output of queryString = "+\"好\"…
hyprstack
  • 4,043
  • 6
  • 46
  • 89
0
votes
1 answer

How to transform array in json using velocity template for aws api gateway?

I've been working on writing velocity templates for aws api-gateway to transform the json response from my api to give a consistent response to the user. I've been trying to convert this json: { "amountCharges": [ "charge1", "charge2",…
0
votes
1 answer

Optional relation on MySQL RDB with foreign keys using AWS Appsync

I've got an Aurora Serverless RDB set up with a couple tables with a foreign key. I've got some basic VTL resolvers working at translating the GraphQL queries to SQL, but I'm running into trouble when one of the referenced objects only shows up on…
RandomEngy
  • 14,931
  • 5
  • 70
  • 113
0
votes
1 answer

Incrementing a VTL variable in JavaScript function