vtl

Subtract months from date in velocity

核能气质少年 提交于 2021-02-08 11:02:12
问题 I am trying to get the date a certain number of months ago from a given date I've tried converting to Calendar to then use the add method, but that didn't work: #set( $myCalendar = $date.toCalendar($endDate)) #set( $startdate = $calendarstart.add("MONTH", -$minusMonths)) I've tried to do this in a few different ways: #set( $temp = 0 - $numberOfMissedPremiums) #evaluate($calendarstart.add( 2 , $temp )) #set( $a = $calendarstart.add( 2 , $temp )) I've even tried defining blocks, but that didn't

Subtract months from date in velocity

荒凉一梦 提交于 2021-02-08 11:01:41
问题 I am trying to get the date a certain number of months ago from a given date I've tried converting to Calendar to then use the add method, but that didn't work: #set( $myCalendar = $date.toCalendar($endDate)) #set( $startdate = $calendarstart.add("MONTH", -$minusMonths)) I've tried to do this in a few different ways: #set( $temp = 0 - $numberOfMissedPremiums) #evaluate($calendarstart.add( 2 , $temp )) #set( $a = $calendarstart.add( 2 , $temp )) I've even tried defining blocks, but that didn't

VTL: How it recognizes images

ⅰ亾dé卋堺 提交于 2021-01-29 19:30:37
问题 We documentate all our programs with VTL, and when you print them there are images where they shouldn't be . We cannot modify each one of them because there are thousand of pages. I wanted to put a macro at the beginning that detects the images , and put a page-breaker before them. So , the problem is, I cannot find how VTL recognizes the images when looping through the code. 来源: https://stackoverflow.com/questions/60299737/vtl-how-it-recognizes-images

VTL: How it recognizes images

不羁的心 提交于 2021-01-29 14:50:11
问题 We documentate all our programs with VTL, and when you print them there are images where they shouldn't be . We cannot modify each one of them because there are thousand of pages. I wanted to put a macro at the beginning that detects the images , and put a page-breaker before them. So , the problem is, I cannot find how VTL recognizes the images when looping through the code. 来源: https://stackoverflow.com/questions/60299737/vtl-how-it-recognizes-images

velocity template loop through array to create string

╄→гoц情女王★ 提交于 2020-08-10 19:30:05
问题 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 = "+\"好\" +\"克力\"" So far I have managed something like this: 24: #set($listOfWords = ["好" "克力"]) 25: #set($queryString = "") 26: #foreach($word in $listOfWords) 27: #if( $velocityCount == 1 ) 28: #set($queryString = "+\"$word\"") 29: #else 30: #set($queryString

Output part of a string in velocity

孤街醉人 提交于 2020-01-11 04:37:51
问题 apologies if I waffle or talk a bit of jibberish but I'm new to velocity, and these forums! I need to check the contents of a string for a certain character and output the second part of the text if it appears. For example: set ($string = "This is a long string *** but I only want to output this on my email"). I want to output all text after the 3 Asterisks. I've scoured the forums but cant quite find anything that helps me completely. 回答1: Velocity is just a façade for real Java objects, so

AWS API Gateway - How do I get the date/timestamp/epoch in a body mapping template?

喜欢而已 提交于 2019-12-21 17:57:24
问题 I need to include the request time in the body mapping template for an API Gateway method. Is there a date/time variable or function? I couldn't find anything in the template reference. Example body mapping template: Action=SendMessage&MessageBody=$util.urlEncode("{""timestamp"":""TIMESTAMP_HERE"",""body-json"":$input.json('$'),""params"":""$input.params()""}") 回答1: UPDATE: API Gateway just added two new context variables http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway

IntelliJ IDEA override $user

一笑奈何 提交于 2019-12-21 04:49:15
问题 It's a quite simple question, but I can't find an answer to it using SO-Search and Google. Is it possible to override the default $user VTL-variable used in file-templates globally, instead of setting it in each template with #set($user = "...") ? Like some sort of setup-script for IntelliJ itself, where I can alter the value? Thanks in advance. By the way, I'm using IntelliJ Ultimate 12.1.6. 回答1: You want to modify the IntelliJ's .vmoptions file(s) in a text editor. In Windows, edit IntelliJ

Create and iterate through an array in Velocity Template Language

纵饮孤独 提交于 2019-12-18 01:29:07
问题 How to create an array in VTL and add contents to the array? Also how to retrieve the contents of the array by index? 回答1: According to Apache Velocity User Guide, right hand side of assignments can be of type Variable reference List item String literal Property reference Method reference Number literal ArrayList Map You can create an empty list, which would satisfy all your needs for an array, in an Apache Velocity template with an expression like: #set($foo = []) or initialize values: #set(