Velocity - If/Then Statement for Previous Date
Hello!
Back with another (likely) basic question I can't seem to parse:
##Standard Velocity Date/Time Fields
#set( $defaultTimeZone = $date.getTimeZone().getTimeZone("America/Chicago") )
#set( $defaultLocale = $date.getLocale() )
#set( $calNow = $date.getCalendar() )
#set( $ret = $calNow.setTimeZone($defaultTimeZone) )
#set( $calConst = $field.in($calNow) )
#set( $ISO8601DateOnly = "yyyy-MM-dd" )
#set( $ISO8601DateTime = "yyyy-MM-dd'T'HH:mm:ss" )
#set( $ISO8601DateTimeWithSpace = "yyyy-MM-dd HH:mm:ss" )
#set( $ISO8601DateTimeWithMillisUTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" )
#set( $ISO8601DateTimeWithMillisTZ = "yyyy-MM-dd'T'HH:mm:ss.SSSZ" )
##Looks for membership date of today and prints Member full name
#foreach ( $item in $customerProfilesList )
#if ( $item.membershipDate.equals($calNow.add($calConst.DATE,-1)) )
$item.fullName##
#else
#end
#end
Trying to write a script that takes a DATE field (formatted as YYYY-MM-DD) and if it matches yesterday's date - prints the Full Name from that particular record.
It doesn't throw an error when I preview or test, but it doesn't work. I had got it to work using the current date, but our data source currently updates overnight so there's a 24-hour lag time unfortunately.