SOLVED

Commas In-Between Outputs from Single Field?

Go to solution
nhabischWings
Level 6

Hello!
Sorry, back again with more fun weird use cases. I'm looking to see if it is possible to have commas between outputs from a single field if there is more than one result? Here is my current script that looks for a opening date in the last 5 days and prints the Full Name:

##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" )
## iterate Customer Profiles, looking for those with Membership Opening yesterday
#foreach ( $item in $customerProfilesList )
#set( $membershipOpeningDate = $convert.parseDate(
    $item.membershipDate,
    $ISO8601DateOnly, 
    $defaultLocale, 
    $defaultTimeZone 
) )
##Looks to see if Membership date is in last 5 days, due to data upload
#if ( ($item.membershipStatus.equals("Member")) && ( ($date.difference($calNow,$membershipOpeningDate).getDays().intValue().equals(-1)) || ($date.difference($calNow,$membershipOpeningDate).getDays().intValue().equals(-2)) || ($date.difference($calNow,$membershipOpeningDate).getDays().intValue().equals(-3)) || ($date.difference($calNow,$membershipOpeningDate).getDays().intValue().equals(-4)) || ($date.difference($calNow,$membershipOpeningDate).getDays().intValue().equals(-5)) ) )
$item.fullName##
#else
#end
#end

I looked into using Sanford's solution here: Marketo tokens - commas and spaces when using seve... - Marketing Nation but that was looking at output from several fields potentially, versus one field - so I was not sure if the concept would be the same?

 

Tags (2)
1 ACCEPTED SOLUTION
SanfordWhiteman
Level 10 - Community Moderator

Inside the loop, you’re continually setting $fullNames to an empty list and then populating it with a single item.

View solution in original post

12 REPLIES 12