Re: Multiple tracked links velocity script - nested foreach loop

Jon_Wright
Level 4

Multiple tracked links velocity script - nested foreach loop

Hi

I'm running into some issues outputting multiple tracked links using Velocity, I know Marketo doesn't allow for this so you have to use a workaround (cue shout out to Sanford's blog piece)

 

But I still seem to have links overwritten when using the script below. I'm pretty sure it must be something to do with the nested foreach loops as the workaround works fine in other emails. Note, I'm actually using a different workaround supplied by Sanford here https://nation.marketo.com/t5/Product-Discussions/Conditional-forEach-statement-in-Velocity-Script/t...

This works fine in preview, but when I send a test the tracked links go to the wrong urls

 

Quick summary of script.

It's selecting a lead's sessions from the allSession JSON, using a semi colon separated list of session ids contained in a lead field

Setting a unique list of days the lead has sessions for

Looping over the the list of days and then looping over a separate list of sessions for that day and outputting those

e.g.

MON: session 1, session 4, session 6

WED: session 7, session 9, session 9

Maybe I've overcomplicated this, I did start building a separate token for each day but nested loops seemed more fun...

 

@SanfordWhiteman  I know you love this stuff...

 

 

 

#set( $allSessions = 
[
  {
    "sessionId": "249",
    "sessionName": "Beyond Connectivity kick off",
    "sessionDay": "Tuesday",
    "sessionRunningTime": "15:00-16:30 CET",
    "sessionStartISO": "2020-10-13T13:00:00Z",
    "sessionStartDateText": "Tuesday 13 October",
    "sessionColor": "#dc131b",
    "sessionTheme": "Beyond Connectivity",
    "sessionCalendar": "https://ics.agical.io/?subject=Beyond%20Connectivity%20kick%20off&dtstart=2020-10-13T13:00:00Z&dtend=2020-10-13T14:30:00Z&description=https://dtws.tmforum.org/session/249&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/249"
  },
  {
    "sessionId": "247",
    "sessionName": "Intro to Collaboration: Autonomous Networks kick off",
    "sessionDay": "Tuesday",
    "sessionRunningTime": "17:00-18:00 CET",
    "sessionStartISO": "2020-10-13T15:00:00Z",
    "sessionStartDateText": "Tuesday 13 October",
    "sessionColor": "#07c2c7",
    "sessionTheme": "Autonomous Networks & the Edge",
    "sessionCalendar": "https://ics.agical.io/?subject=Intro%20to%20Collaboration%3A%20Autonomous%20Networks%20kick%20off&dtstart=2020-10-13T15:00:00Z&dtend=2020-10-13T16:00:00Z&description=https://dtws.tmforum.org/session/247&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/247"
  },
  {
    "sessionId": "166",
    "sessionName": "Making autonomous networks a reality",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "10:00-11:30 CET",
    "sessionStartISO": "2020-10-14T08:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#07c2c7",
    "sessionTheme": "Autonomous Networks & the Edge",
    "sessionCalendar": "https://ics.agical.io/?subject=Making%20autonomous%20networks%20a%20reality&dtstart=2020-10-14T08:00:00Z&dtend=2020-10-14T09:30:00Z&description=https://dtws.tmforum.org/session/166&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/166"
  },
  {
    "sessionId": "181",
    "sessionName": "Catalyst panel - TEST",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "11:00-11:30 CET",
    "sessionStartISO": "2020-10-14T09:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#7b1acb",
    "sessionTheme": "AI, Data & Analytics",
    "sessionCalendar": "https://ics.agical.io/?subject=Catalyst%20panel%20-%20TEST&dtstart=2020-10-14T09:00:00Z&dtend=2020-10-14T09:30:00Z&description=https://dtws.tmforum.org/session/181&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/181"
  },
  {
    "sessionId": "226",
    "sessionName": "Catalyst showcase panel: AI Ops: Delivering advanced services through intelligent operations",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "11:10-11:50 CET",
    "sessionStartISO": "2020-10-14T09:10:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#7b1acb",
    "sessionTheme": "AI, Data & Analytics",
    "sessionCalendar": "https://ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20AI%20Ops%3A%20Delivering%20advanced%20services%20through%20intelligent%20operations&dtstart=2020-10-14T09:10:00Z&dtend=2020-10-14T09:50:00Z&description=https://dtws.tmforum.org/session/226&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/226"
  },
  {
    "sessionId": "145",
    "sessionName": "The building blocks for getting organizational transformation right",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "12:00-13:20 CET",
    "sessionStartISO": "2020-10-14T10:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#757679",
    "sessionTheme": "The Human Factor",
    "sessionCalendar": "https://ics.agical.io/?subject=The%20building%20blocks%20for%20getting%20organizational%20transformation%20right&dtstart=2020-10-14T10:00:00Z&dtend=2020-10-14T11:20:00Z&description=https://dtws.tmforum.org/session/145&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/145"
  },
  {
    "sessionId": "160",
    "sessionName": "CX strategies to win the brand battle",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "13:00-14:30 CET",
    "sessionStartISO": "2020-10-14T11:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#e05500",
    "sessionTheme": "Customer Experience & Trust",
    "sessionCalendar": "https://ics.agical.io/?subject=CX%20strategies%20to%20win%20the%20brand%20battle&dtstart=2020-10-14T11:00:00Z&dtend=2020-10-14T12:30:00Z&description=https://dtws.tmforum.org/session/160&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/160"
  },
  {
    "sessionId": "261",
    "sessionName": "An Introduction to the Open APIs collaboration project",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "15:00-16:00 CET",
    "sessionStartISO": "2020-10-14T13:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#1a3ca3",
    "sessionTheme": "Cloud Native IT & Agility",
    "sessionCalendar": "https://ics.agical.io/?subject=An%20Introduction%20to%20the%20Open%20APIs%20collaboration%20project&dtstart=2020-10-14T13:00:00Z&dtend=2020-10-14T14:00:00Z&description=https://dtws.tmforum.org/session/261&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/261"
  },
  {
    "sessionId": "209",
    "sessionName": "Digital Leadership Roundtable: The path to becoming cloud native",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "16:00-17:45 CET",
    "sessionStartISO": "2020-10-14T14:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#1a3ca3",
    "sessionTheme": "Cloud Native IT & Agility",
    "sessionCalendar": "https://ics.agical.io/?subject=Digital%20Leadership%20Roundtable%3A%20The%20path%20to%20becoming%20cloud%20native&dtstart=2020-10-14T14:00:00Z&dtend=2020-10-14T15:45:00Z&description=https://dtws.tmforum.org/session/209&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/209"
  },
  {
    "sessionId": "136",
    "sessionName": "Wake up to the shared B2B value opportunity",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "16:30-18:00 CET",
    "sessionStartISO": "2020-10-14T14:30:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#dc131b",
    "sessionTheme": "Beyond Connectivity",
    "sessionCalendar": "https://ics.agical.io/?subject=Wake%20up%20to%20the%20shared%20B2B%20value%20opportunity&dtstart=2020-10-14T14:30:00Z&dtend=2020-10-14T16:00:00Z&description=https://dtws.tmforum.org/session/136&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/136"
  },
  {
    "sessionId": "263",
    "sessionName": "Headliner: New ecosystem dynamics",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "18:00-18:30 CET",
    "sessionStartISO": "2020-10-14T16:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#dc131b",
    "sessionTheme": "Beyond Connectivity",
    "sessionCalendar": "https://ics.agical.io/?subject=Headliner%3A%20New%20ecosystem%20dynamics&dtstart=2020-10-14T16:00:00Z&dtend=2020-10-14T16:30:00Z&description=https://dtws.tmforum.org/session/263&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/263"
  },
  {
    "sessionId": "227",
    "sessionName": "Catalyst showcase panel: AI Ops: Delivering advanced services through intelligent operations",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "18:10-18:50 CET",
    "sessionStartISO": "2020-10-14T16:10:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#7b1acb",
    "sessionTheme": "AI, Data & Analytics",
    "sessionCalendar": "https://ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20AI%20Ops%3A%20Delivering%20advanced%20services%20through%20intelligent%20operations&dtstart=2020-10-14T16:10:00Z&dtend=2020-10-14T16:50:00Z&description=https://dtws.tmforum.org/session/227&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/227"
  },
  {
    "sessionId": "212",
    "sessionName": "Catalyst showcase panel: Automating enterprise services delivery through open digital standards",
    "sessionDay": "Thursday",
    "sessionRunningTime": "09:10-09:50 CET",
    "sessionStartISO": "2020-10-15T07:10:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#1a3ca3",
    "sessionTheme": "Cloud Native IT & Agility",
    "sessionCalendar": "https://ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20Automating%20enterprise%20services%20delivery%20through%20open%20digital%20standards&dtstart=2020-10-15T07:10:00Z&dtend=2020-10-15T07:50:00Z&description=https://dtws.tmforum.org/session/212&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/212"
  },
  {
    "sessionId": "232",
    "sessionName": "Catalyst showcase panel: Innovations for sustainable digital future",
    "sessionDay": "Thursday",
    "sessionRunningTime": "10:10-10:50 CET",
    "sessionStartISO": "2020-10-15T08:10:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#757679",
    "sessionTheme": "The Human Factor",
    "sessionCalendar": "https://ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20Innovations%20for%20sustainable%20digital%20future&dtstart=2020-10-15T08:10:00Z&dtend=2020-10-15T08:50:00Z&description=https://dtws.tmforum.org/session/232&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/232"
  },
  {
    "sessionId": "149",
    "sessionName": "Getting platform business models right",
    "sessionDay": "Thursday",
    "sessionRunningTime": "10:30-13:00 CET",
    "sessionStartISO": "2020-10-15T08:30:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#dc131b",
    "sessionTheme": "Beyond Connectivity",
    "sessionCalendar": "https://ics.agical.io/?subject=Getting%20platform%20business%20models%20right&dtstart=2020-10-15T08:30:00Z&dtend=2020-10-15T11:00:00Z&description=https://dtws.tmforum.org/session/149&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/149"
  },
  {
    "sessionId": "139",
    "sessionName": "Laying down winning foundations with AI, analytics and automation",
    "sessionDay": "Thursday",
    "sessionRunningTime": "11:00-12:20 CET",
    "sessionStartISO": "2020-10-15T09:00:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#7b1acb",
    "sessionTheme": "AI, Data & Analytics",
    "sessionCalendar": "https://ics.agical.io/?subject=Laying%20down%20winning%20foundations%20with%20AI%2C%20analytics%20and%20automation&dtstart=2020-10-15T09:00:00Z&dtend=2020-10-15T10:20:00Z&description=https://dtws.tmforum.org/session/139&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/139"
  },
  {
    "sessionId": "167",
    "sessionName": "Network automation and softwarization capability expansion",
    "sessionDay": "Thursday",
    "sessionRunningTime": "12:30-14:00 CET",
    "sessionStartISO": "2020-10-15T10:30:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#07c2c7",
    "sessionTheme": "Autonomous Networks & the Edge",
    "sessionCalendar": "https://ics.agical.io/?subject=Network%20automation%20and%20softwarization%20capability%20expansion&dtstart=2020-10-15T10:30:00Z&dtend=2020-10-15T12:00:00Z&description=https://dtws.tmforum.org/session/167&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/167"
  },
  {
    "sessionId": "245",
    "sessionName": "Digital Leadership Roundtable: Intelligent automation is the key to unlocking digital transformation",
    "sessionDay": "Thursday",
    "sessionRunningTime": "13:00-14:00 CET",
    "sessionStartISO": "2020-10-15T11:00:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#e05500",
    "sessionTheme": "Customer Experience & Trust",
    "sessionCalendar": "https://ics.agical.io/?subject=Digital%20Leadership%20Roundtable%3A%20Intelligent%20automation%20is%20the%20key%20to%20unlocking%20digital%20transformation&dtstart=2020-10-15T11:00:00Z&dtend=2020-10-15T12:00:00Z&description=https://dtws.tmforum.org/session/245&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/245"
  },
  {
    "sessionId": "161",
    "sessionName": "Let''s talk customer centricity",
    "sessionDay": "Thursday",
    "sessionRunningTime": "14:30-16:00 CET",
    "sessionStartISO": "2020-10-15T12:30:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#e05500",
    "sessionTheme": "Customer Experience & Trust",
    "sessionCalendar": "https://ics.agical.io/?subject=Let%27%27s%20talk%20customer%20centricity&dtstart=2020-10-15T12:30:00Z&dtend=2020-10-15T14:00:00Z&description=https://dtws.tmforum.org/session/161&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/161"
  },
  {
    "sessionId": "213",
    "sessionName": "Catalyst showcase panel: Automating enterprise services delivery through open digital standards",
    "sessionDay": "Thursday",
    "sessionRunningTime": "15:10-15:50 CET",
    "sessionStartISO": "2020-10-15T13:10:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#1a3ca3",
    "sessionTheme": "Cloud Native IT & Agility",
    "sessionCalendar": "https://ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20Automating%20enterprise%20services%20delivery%20through%20open%20digital%20standards&dtstart=2020-10-15T13:10:00Z&dtend=2020-10-15T13:50:00Z&description=https://dtws.tmforum.org/session/213&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/213"
  },
  {
    "sessionId": "211",
    "sessionName": "CXO Summit: Failing fast, learning faster",
    "sessionDay": "Thursday",
    "sessionRunningTime": "16:30-18:00 CET",
    "sessionStartISO": "2020-10-15T14:30:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#757679",
    "sessionTheme": "The Human Factor",
    "sessionCalendar": "https://ics.agical.io/?subject=CXO%20Summit%3A%20Failing%20fast%2C%20learning%20faster&dtstart=2020-10-15T14:30:00Z&dtend=2020-10-15T16:00:00Z&description=https://dtws.tmforum.org/session/211&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/211"
  },
  {
    "sessionId": "233",
    "sessionName": "Catalyst showcase panel: Innovations for sustainable digital future",
    "sessionDay": "Thursday",
    "sessionRunningTime": "18:10-18:50 CET",
    "sessionStartISO": "2020-10-15T16:10:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#757679",
    "sessionTheme": "The Human Factor",
    "sessionCalendar": "https://ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20Innovations%20for%20sustainable%20digital%20future&dtstart=2020-10-15T16:10:00Z&dtend=2020-10-15T16:50:00Z&description=https://dtws.tmforum.org/session/233&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/233"
  }
]
)

 

 

 

 

 

 

 

 

##split semicolon data into list
#if($lead.DTWSJSONBookmarkedSessions.isEmpty() )
#set($personBookmarks = [])
#else
#set($personBookmarks = $lead.DTWSJSONBookmarkedSessions.split(";"))
#end
##get list of person bookmarks details
#set( $personBookmarkDetails = [] ) 
#foreach( $session in $allSessions )
#if($personBookmarks.contains($session.sessionId))
#set( $void = $personBookmarkDetails.add($session) )        
#end
#end
##get unique list of days person has boomarks for
#set( $personBookmarkDays = [] ) 
#foreach( $session in $allSessions )
#if($personBookmarks.contains($session.sessionId)
&& !$personBookmarkDays.contains($session.sessionDay))
#set( $void = $personBookmarkDays.add($session.sessionDay) )        
#end
#end
##output heading text
#if( $personBookmarkDetails.isEmpty() )
#else
<!-- SECTION - Heading -->
<!--[if mso | IE]>
<table
   align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"
   >
   <tr>
      <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
         <![endif]-->
         <div style="background:#FFFFFF;background-color:#FFFFFF;margin:0px auto;max-width:600px;">
            <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#FFFFFF;background-color:#FFFFFF;width:100%;">
               <tbody>
                  <tr>
                     <td style="border-left:1px solid #2099d0;border-right:1px solid #2099d0;direction:ltr;font-size:0px;padding:0px;text-align:center;">
                        <!--[if mso | IE]>
                        <table role="presentation" border="0" cellpadding="0" cellspacing="0">
                           <tr>
                              <td
                                 class="" style="vertical-align:top;width:598px;"
                                 >
                                 <![endif]-->
                                 <div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
                                    <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
                                       <tr>
                                          <td align="center" style="font-size:0px;padding:20px;word-break:break-word;">
                                             <div style="font-family:Arial;font-size:24px;font-weight:600;line-height:28px;text-align:center;color:#29303a;">Thanks for building your schedule, here is a reminder of <span style="color: #2099d0;">your week ahead</span></div>
                                          </td>
                                       </tr>
                                    </table>
                                 </div>
                                 <!--[if mso | IE]>
                              </td>
                           </tr>
                        </table>
                        <![endif]-->
                     </td>
                  </tr>
               </tbody>
            </table>
         </div>
         <!--[if mso | IE]>
      </td>
   </tr>
</table>
<![endif]-->
</td>
</tr>
#end
##output bookmarks HTML
#if( $personBookmarkDetails.isEmpty() )
#else
#set($numberOfBookmarks = $personBookmarkDetails.size())
#foreach($day in $personBookmarkDays)
<!-- SECTION - Session Listing -->
                <tr class="mktoModule" id="html-block" mktoname="HTML block">
                    <td>
<!--[if mso | IE]>
<table
   align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"
   >
   <tr>
      <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
         <![endif]-->
         <div style="margin:0px auto;max-width:600px;">
            <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
               <tbody>
                  <tr>
                     <td style="border-left:1px solid #2099d0;border-right:1px solid #2099d0;direction:ltr;font-size:0px;padding:10px 0px;text-align:center;">
                        <!--[if mso | IE]>
                        <table role="presentation" border="0" cellpadding="0" cellspacing="0">
                           <tr>
                              <td
                                 class="" style="vertical-align:middle;width:119.6px;"
                                 >
                                 <![endif]-->
                                 <div class="mj-column-per-20 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:middle;width:100%;">
                                    <table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
                                       <tbody>
                                          <tr>
                                             <td style="background-color:#ffffff;vertical-align:middle;padding:20px 0px 10px 0px;">
                                                <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="" width="100%">
                                                   <tr>
                                                      <td align="center" style="font-size:0px;padding:10px;padding-top:0px;word-break:break-word;">
                                                         <div style="font-family:Arial;font-size:40px;line-height:1;text-align:center;color:#2099d0;"><b>${day.substring(0,3).toUpperCase()}</b></div>
                                                      </td>
                                                   </tr>
                                                </table>
                                             </td>
                                          </tr>
                                       </tbody>
                                    </table>
                                 </div>
                                 <!--[if mso | IE]>
                              </td>
                              <td
                                 class="" style="vertical-align:top;width:478.4px;"
                                 >
                                 <![endif]-->
                                 <div class="mj-column-per-80 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
                                    <table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
                                       <tbody>
                                          <tr>
                                             <td style="background-color:#ffffff;border-left:8px solid #2099d0;vertical-align:top;padding:10px 0px 10px 0px;">
                                                <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="" width="100%">
                                                   <tr>
                                                      <td align="left" style="font-size:0px;padding:10px;word-break:break-word;">
                                                         <div style="font-family:Arial;font-size:14px;line-height:20px;text-align:left;color:#29303a;">
##get list of person bookmarks details by day
#set( $personBookmarkDetailsByDay = [] ) 
#foreach( $bookmark in $personBookmarkDetails )
#if($bookmark.sessionDay == $day)
#set( $void = $personBookmarkDetailsByDay.add($bookmark) )        
#end
#end
##output calendar links
#foreach($boomark in $personBookmarkDetailsByDay)
<b>• ${boomark.sessionRunningTime}</b> ${boomark.sessionName}
#if( $foreach.index.equals(0) )
#set( $URL_0 = $personBookmarkDetailsByDay[0].sessionCalendar.substring(8))
<a href="https://${URL_0}" style="color: #2099d0" target="_blank" id="">
#elseif( $foreach.index.equals(1) )
#set( $URL_1 = $personBookmarkDetailsByDay[1].sessionCalendar.substring(8) )
<a href="https://${URL_1}" style="color: #2099d0" target="_blank" id="">
#elseif( $foreach.index.equals(2) )
#set( $URL_2 = $personBookmarkDetailsByDay[2].sessionCalendar.substring(8) )
<a href="https://${URL_2}" style="color: #2099d0" target="_blank" id="">
#elseif( $foreach.index.equals(3) )
#set( $URL_3 = $personBookmarkDetailsByDay[3].sessionCalendar.substring(8) )
<a href="https://${URL_3}" style="color: #2099d0" target="_blank" id="">
#elseif( $foreach.index.equals(4) )
#set( $URL_4 = $personBookmarkDetailsByDay[4].sessionCalendar.substring(8) )
<a href="https://${URL_4}" style="color: #2099d0" target="_blank" id="">
#elseif( $foreach.index.equals(5) )
#set( $URL_5 = $personBookmarkDetailsByDay[5].sessionCalendar.substring(8) )
<a href="https://${URL_5}" style="color: #2099d0" target="_blank" id="">
#elseif( $foreach.index.equals(6) )
#set( $URL_6 = $personBookmarkDetailsByDay[6].sessionCalendar.substring(8) )
<a href="https://${URL_6}" style="color: #2099d0" target="_blank" id="">
#elseif( $foreach.index.equals(7) )
#set( $URL_7 = $personBookmarkDetailsByDay[7].sessionCalendar.substring(8) )
<a href="https://${URL_7}" style="color: #2099d0" target="_blank" id="">
#elseif( $foreach.index.equals(8) )
#set( $URL_8 = $personBookmarkDetailsByDay[8].sessionCalendar.substring(8) )
<a href="https://${URL_8}" style="color: #2099d0" target="_blank" id="">
#elseif( $foreach.index.equals(9) )
#set( $URL_9 = $personBookmarkDetailsByDay[9].sessionCalendar.substring(8) )
<a href="https://${URL_9}" style="color: #2099d0" target="_blank" id="">
#elseif( $foreach.index.equals(10) )
#set( $URL_10 = $personBookmarkDetailsByDay[10].sessionCalendar.substring(8) )
<a href="https://${URL_10}" style="color: #2099d0" target="_blank" id="">
#end                                                        
Add&nbsp;to&nbsp;my&nbsp;calendar</a>
<br>
#end
                                                         </div>
                                                      </td>
                                                   </tr>
                                                </table>
                                             </td>
                                          </tr>
                                       </tbody>
                                    </table>
                                 </div>
                                 <!--[if mso | IE]>
                              </td>
                           </tr>
                        </table>
                        <![endif]-->
                     </td>
                  </tr>
               </tbody>
            </table>
         </div>
         <!--[if mso | IE]>
      </td>
   </tr>
</table>
<![endif]-->
#end
#end

 

 

 

 

 

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Multiple tracked links velocity script - nested foreach loop

Hi Jon,

 

That earliest method (with the dynamically created variable instead of the substring) is most reliable still. Have you tried with that?

 

 

Jon_Wright
Level 4

Re: Multiple tracked links velocity script - nested foreach loop

Hi Sanford

 

Unfortunately that doesn't seem to work either, although I'm sure you may spot something I'm doing wrong in my code. Here it is in case you wanted to take a look ( I removed a lot of the HTML for simplicity).

 

This works in preview, but when I send a test the first link in the first outer loop gets overwritten with the first link in the 2nd outer loop. I ended up removing tracking so the links did at least work but think I may have to go back to an if then else statement on each day for this to work with tracking. Any pointers appreciated!

 

#set( $allSessions = 
[
  {
    "sessionId": "249",
    "sessionName": "Beyond Connectivity kick off",
    "sessionDay": "Tuesday",
    "sessionRunningTime": "15:00-16:30 CET",
    "sessionStartISO": "2020-10-13T13:00:00Z",
    "sessionStartDateText": "Tuesday 13 October",
    "sessionColor": "#dc131b",
    "sessionTheme": "Beyond Connectivity",
    "sessionCalendar": "ics.agical.io/?subject=Beyond%20Connectivity%20kick%20off&dtstart=2020-10-13T13:00:00Z&dtend=2020-10-13T14:30:00Z&description=https://dtws.tmforum.org/session/249&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/249"
  },
  {
    "sessionId": "247",
    "sessionName": "Intro to Collaboration: Autonomous Networks kick off",
    "sessionDay": "Tuesday",
    "sessionRunningTime": "17:00-18:00 CET",
    "sessionStartISO": "2020-10-13T15:00:00Z",
    "sessionStartDateText": "Tuesday 13 October",
    "sessionColor": "#07c2c7",
    "sessionTheme": "Autonomous Networks & the Edge",
    "sessionCalendar": "ics.agical.io/?subject=Intro%20to%20Collaboration%3A%20Autonomous%20Networks%20kick%20off&dtstart=2020-10-13T15:00:00Z&dtend=2020-10-13T16:00:00Z&description=https://dtws.tmforum.org/session/247&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/247"
  },
  {
    "sessionId": "166",
    "sessionName": "Making autonomous networks a reality",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "10:00-11:30 CET",
    "sessionStartISO": "2020-10-14T08:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#07c2c7",
    "sessionTheme": "Autonomous Networks & the Edge",
    "sessionCalendar": "ics.agical.io/?subject=Making%20autonomous%20networks%20a%20reality&dtstart=2020-10-14T08:00:00Z&dtend=2020-10-14T09:30:00Z&description=https://dtws.tmforum.org/session/166&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/166"
  },
  {
    "sessionId": "181",
    "sessionName": "Catalyst panel - TEST",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "11:00-11:30 CET",
    "sessionStartISO": "2020-10-14T09:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#7b1acb",
    "sessionTheme": "AI, Data & Analytics",
    "sessionCalendar": "ics.agical.io/?subject=Catalyst%20panel%20-%20TEST&dtstart=2020-10-14T09:00:00Z&dtend=2020-10-14T09:30:00Z&description=https://dtws.tmforum.org/session/181&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/181"
  },
  {
    "sessionId": "226",
    "sessionName": "Catalyst showcase panel: AI Ops: Delivering advanced services through intelligent operations",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "11:10-11:50 CET",
    "sessionStartISO": "2020-10-14T09:10:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#7b1acb",
    "sessionTheme": "AI, Data & Analytics",
    "sessionCalendar": "ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20AI%20Ops%3A%20Delivering%20advanced%20services%20through%20intelligent%20operations&dtstart=2020-10-14T09:10:00Z&dtend=2020-10-14T09:50:00Z&description=https://dtws.tmforum.org/session/226&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/226"
  },
  {
    "sessionId": "145",
    "sessionName": "The building blocks for getting organizational transformation right",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "12:00-13:20 CET",
    "sessionStartISO": "2020-10-14T10:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#757679",
    "sessionTheme": "The Human Factor",
    "sessionCalendar": "ics.agical.io/?subject=The%20building%20blocks%20for%20getting%20organizational%20transformation%20right&dtstart=2020-10-14T10:00:00Z&dtend=2020-10-14T11:20:00Z&description=https://dtws.tmforum.org/session/145&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/145"
  },
  {
    "sessionId": "160",
    "sessionName": "CX strategies to win the brand battle",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "13:00-14:30 CET",
    "sessionStartISO": "2020-10-14T11:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#e05500",
    "sessionTheme": "Customer Experience & Trust",
    "sessionCalendar": "ics.agical.io/?subject=CX%20strategies%20to%20win%20the%20brand%20battle&dtstart=2020-10-14T11:00:00Z&dtend=2020-10-14T12:30:00Z&description=https://dtws.tmforum.org/session/160&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/160"
  },
  {
    "sessionId": "261",
    "sessionName": "An Introduction to the Open APIs collaboration project",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "15:00-16:00 CET",
    "sessionStartISO": "2020-10-14T13:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#1a3ca3",
    "sessionTheme": "Cloud Native IT & Agility",
    "sessionCalendar": "ics.agical.io/?subject=An%20Introduction%20to%20the%20Open%20APIs%20collaboration%20project&dtstart=2020-10-14T13:00:00Z&dtend=2020-10-14T14:00:00Z&description=https://dtws.tmforum.org/session/261&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/261"
  },
  {
    "sessionId": "209",
    "sessionName": "Digital Leadership Roundtable: The path to becoming cloud native",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "16:00-17:45 CET",
    "sessionStartISO": "2020-10-14T14:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#1a3ca3",
    "sessionTheme": "Cloud Native IT & Agility",
    "sessionCalendar": "ics.agical.io/?subject=Digital%20Leadership%20Roundtable%3A%20The%20path%20to%20becoming%20cloud%20native&dtstart=2020-10-14T14:00:00Z&dtend=2020-10-14T15:45:00Z&description=https://dtws.tmforum.org/session/209&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/209"
  },
  {
    "sessionId": "136",
    "sessionName": "Wake up to the shared B2B value opportunity",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "16:30-18:00 CET",
    "sessionStartISO": "2020-10-14T14:30:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#dc131b",
    "sessionTheme": "Beyond Connectivity",
    "sessionCalendar": "ics.agical.io/?subject=Wake%20up%20to%20the%20shared%20B2B%20value%20opportunity&dtstart=2020-10-14T14:30:00Z&dtend=2020-10-14T16:00:00Z&description=https://dtws.tmforum.org/session/136&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/136"
  },
  {
    "sessionId": "263",
    "sessionName": "Headliner: New ecosystem dynamics",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "18:00-18:30 CET",
    "sessionStartISO": "2020-10-14T16:00:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#dc131b",
    "sessionTheme": "Beyond Connectivity",
    "sessionCalendar": "ics.agical.io/?subject=Headliner%3A%20New%20ecosystem%20dynamics&dtstart=2020-10-14T16:00:00Z&dtend=2020-10-14T16:30:00Z&description=https://dtws.tmforum.org/session/263&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/263"
  },
  {
    "sessionId": "227",
    "sessionName": "Catalyst showcase panel: AI Ops: Delivering advanced services through intelligent operations",
    "sessionDay": "Wednesday",
    "sessionRunningTime": "18:10-18:50 CET",
    "sessionStartISO": "2020-10-14T16:10:00Z",
    "sessionStartDateText": "Wednesday 14 October",
    "sessionColor": "#7b1acb",
    "sessionTheme": "AI, Data & Analytics",
    "sessionCalendar": "ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20AI%20Ops%3A%20Delivering%20advanced%20services%20through%20intelligent%20operations&dtstart=2020-10-14T16:10:00Z&dtend=2020-10-14T16:50:00Z&description=https://dtws.tmforum.org/session/227&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/227"
  },
  {
    "sessionId": "212",
    "sessionName": "Catalyst showcase panel: Automating enterprise services delivery through open digital standards",
    "sessionDay": "Thursday",
    "sessionRunningTime": "09:10-09:50 CET",
    "sessionStartISO": "2020-10-15T07:10:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#1a3ca3",
    "sessionTheme": "Cloud Native IT & Agility",
    "sessionCalendar": "ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20Automating%20enterprise%20services%20delivery%20through%20open%20digital%20standards&dtstart=2020-10-15T07:10:00Z&dtend=2020-10-15T07:50:00Z&description=https://dtws.tmforum.org/session/212&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/212"
  },
  {
    "sessionId": "232",
    "sessionName": "Catalyst showcase panel: Innovations for sustainable digital future",
    "sessionDay": "Thursday",
    "sessionRunningTime": "10:10-10:50 CET",
    "sessionStartISO": "2020-10-15T08:10:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#757679",
    "sessionTheme": "The Human Factor",
    "sessionCalendar": "ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20Innovations%20for%20sustainable%20digital%20future&dtstart=2020-10-15T08:10:00Z&dtend=2020-10-15T08:50:00Z&description=https://dtws.tmforum.org/session/232&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/232"
  },
  {
    "sessionId": "149",
    "sessionName": "Getting platform business models right",
    "sessionDay": "Thursday",
    "sessionRunningTime": "10:30-13:00 CET",
    "sessionStartISO": "2020-10-15T08:30:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#dc131b",
    "sessionTheme": "Beyond Connectivity",
    "sessionCalendar": "ics.agical.io/?subject=Getting%20platform%20business%20models%20right&dtstart=2020-10-15T08:30:00Z&dtend=2020-10-15T11:00:00Z&description=https://dtws.tmforum.org/session/149&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/149"
  },
  {
    "sessionId": "139",
    "sessionName": "Laying down winning foundations with AI, analytics and automation",
    "sessionDay": "Thursday",
    "sessionRunningTime": "11:00-12:20 CET",
    "sessionStartISO": "2020-10-15T09:00:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#7b1acb",
    "sessionTheme": "AI, Data & Analytics",
    "sessionCalendar": "ics.agical.io/?subject=Laying%20down%20winning%20foundations%20with%20AI%2C%20analytics%20and%20automation&dtstart=2020-10-15T09:00:00Z&dtend=2020-10-15T10:20:00Z&description=https://dtws.tmforum.org/session/139&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/139"
  },
  {
    "sessionId": "167",
    "sessionName": "Network automation and softwarization capability expansion",
    "sessionDay": "Thursday",
    "sessionRunningTime": "12:30-14:00 CET",
    "sessionStartISO": "2020-10-15T10:30:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#07c2c7",
    "sessionTheme": "Autonomous Networks & the Edge",
    "sessionCalendar": "ics.agical.io/?subject=Network%20automation%20and%20softwarization%20capability%20expansion&dtstart=2020-10-15T10:30:00Z&dtend=2020-10-15T12:00:00Z&description=https://dtws.tmforum.org/session/167&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/167"
  },
  {
    "sessionId": "245",
    "sessionName": "Digital Leadership Roundtable: Intelligent automation is the key to unlocking digital transformation",
    "sessionDay": "Thursday",
    "sessionRunningTime": "13:00-14:00 CET",
    "sessionStartISO": "2020-10-15T11:00:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#e05500",
    "sessionTheme": "Customer Experience & Trust",
    "sessionCalendar": "ics.agical.io/?subject=Digital%20Leadership%20Roundtable%3A%20Intelligent%20automation%20is%20the%20key%20to%20unlocking%20digital%20transformation&dtstart=2020-10-15T11:00:00Z&dtend=2020-10-15T12:00:00Z&description=https://dtws.tmforum.org/session/245&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/245"
  },
  {
    "sessionId": "161",
    "sessionName": "Let''s talk customer centricity",
    "sessionDay": "Thursday",
    "sessionRunningTime": "14:30-16:00 CET",
    "sessionStartISO": "2020-10-15T12:30:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#e05500",
    "sessionTheme": "Customer Experience & Trust",
    "sessionCalendar": "ics.agical.io/?subject=Let%27%27s%20talk%20customer%20centricity&dtstart=2020-10-15T12:30:00Z&dtend=2020-10-15T14:00:00Z&description=https://dtws.tmforum.org/session/161&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/161"
  },
  {
    "sessionId": "213",
    "sessionName": "Catalyst showcase panel: Automating enterprise services delivery through open digital standards",
    "sessionDay": "Thursday",
    "sessionRunningTime": "15:10-15:50 CET",
    "sessionStartISO": "2020-10-15T13:10:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#1a3ca3",
    "sessionTheme": "Cloud Native IT & Agility",
    "sessionCalendar": "ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20Automating%20enterprise%20services%20delivery%20through%20open%20digital%20standards&dtstart=2020-10-15T13:10:00Z&dtend=2020-10-15T13:50:00Z&description=https://dtws.tmforum.org/session/213&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/213"
  },
  {
    "sessionId": "211",
    "sessionName": "CXO Summit: Failing fast, learning faster",
    "sessionDay": "Thursday",
    "sessionRunningTime": "16:30-18:00 CET",
    "sessionStartISO": "2020-10-15T14:30:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#757679",
    "sessionTheme": "The Human Factor",
    "sessionCalendar": "ics.agical.io/?subject=CXO%20Summit%3A%20Failing%20fast%2C%20learning%20faster&dtstart=2020-10-15T14:30:00Z&dtend=2020-10-15T16:00:00Z&description=https://dtws.tmforum.org/session/211&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/211"
  },
  {
    "sessionId": "233",
    "sessionName": "Catalyst showcase panel: Innovations for sustainable digital future",
    "sessionDay": "Thursday",
    "sessionRunningTime": "18:10-18:50 CET",
    "sessionStartISO": "2020-10-15T16:10:00Z",
    "sessionStartDateText": "Thursday 15 October",
    "sessionColor": "#757679",
    "sessionTheme": "The Human Factor",
    "sessionCalendar": "ics.agical.io/?subject=Catalyst%20showcase%20panel%3A%20Innovations%20for%20sustainable%20digital%20future&dtstart=2020-10-15T16:10:00Z&dtend=2020-10-15T16:50:00Z&description=https://dtws.tmforum.org/session/233&reminder=30&location=DTW%20Series%20-%20link%20in%20description",
    "sessionURL": "https://dtws.tmforum.org/session/233"
  }
]
)

##split semicolon data into list
#if($lead.DTWSJSONBookmarkedSessions.isEmpty() )
#set($personBookmarks = [])
#else
#set($personBookmarks = $lead.DTWSJSONBookmarkedSessions.split(";"))
#end
##get list of person boomarks details
#set( $personBookmarkDetails = [] ) 
#foreach( $session in $allSessions )
#if($personBookmarks.contains($session.sessionId))
#set( $void = $personBookmarkDetails.add($session) )        
#end
#end
##get unique list of days person has boomarks for
#set( $personBookmarkDays = [] ) 
#foreach( $session in $personBookmarkDetails )
#if(!$personBookmarkDays.contains($session.sessionDay))
#set( $void = $personBookmarkDays.add($session.sessionDay) )        
#end
#end
##Check not empty
#if( $personBookmarkDetails.isEmpty() )
#else
##Loop over the days person has bookmarks for
#foreach($day in $personBookmarkDays)
${day}
##get list of person boomarks details by day
#set( $personBookmarkDetailsByDay = [] ) 
#foreach( $bookmark in $personBookmarkDetails )
#if($bookmark.sessionDay == $day)
#set( $void = $personBookmarkDetailsByDay.add($bookmark) )        
#end
#end
##output calendar links for each day
#foreach( $bmark in $personBookmarkDetailsByDay )
  #set( $downloadLink = $bmark )
  #evaluate( "${esc.h}set( ${esc.d}downloadLink_${foreach.count} = ${esc.d}downloadLink )" )
#end
#if( $downloadLink_1 )
<a href="http://${downloadLink_1.sessionCalendar}" target="_blank">${downloadLink_1.sessionName}</a>
#end
#if( $downloadLink_2 )
<a href="http://${downloadLink_2.sessionCalendar}" target="_blank">${downloadLink_2.sessionName}</a>
#end
#end
#end