We're getting a ResolveMacroData error in one of our transformations that may be bogging down our site. The transformation includes a check of any categories applied to the document, but that check is apparently causing an Exception error.Here's the full transformation: {% x=0; startDate = FormatDateTime(EventDate, @MMM d@); endDate = FormatDateTime(EventEndDate, @MMM d@); return null; %}
@div class=@list-item@@
@div class=@list-item-date@@
@span class=@list-item-date_small@@{% FormatDateTime(EventDate, @yyyy@) %}@/span@
@div class=@list-item-date_large@@{% startDate %}{% if(startDate != endDate) { if(FormatDateTime(EventEndDate, @MMM@) != FormatDateTime(EventDate, @MMM@)) { return @-@ + endDate } else { return FormatDateTime(EventEndDate, @-d@)} } #%}@/div@
@span class=@list-item-date_small@@{% FormatDateTime(EventDate, @h:mm tt@) %} {% if(Contains(EventTimeZone.toString(), @GMT@)) { return Substring(Replace(EventTimeZone.toString(), @ (US @ Canada)@, @@),12) } else { return EventTimeZone; }#%}@/span@
@span class=@list-item-date_small@@{% if (EventCity.Length @ 0) { %} @p class=@list-item-meta@@{% EventCity %}, {% EventStateCode %}@/p@ {% } #%}@/span@
@/div@
@div class=@list-item-text@@
@h4 class=@list-item-title@@@a href=@{% EventURL.ToString()==@@?Transformation.GetDocumentUrl():EventURL #%}@ target=@{% EventURL.ToString()==@@?@_top@:@_blank@ #%}@ @{% DocumentName %}@/a@@/h4@
{% IfEmpty(ETPCode, @@, @@p class=\@list-item-meta mar-bottom\@@@a href=\@@ + Documents[@/Events@].RelativeURL + @?filter=@ + ETPCode + @\@@@ + IfCompare(ETPCode, @Chapter@, @@, EventChapter + @ @) + ETPCode + @@/a@@/p@@)#%}
@p class=@list-item-meta@@{% foreach(cat in Documents[NodeAliasPath].Categories.Where(@CategoryNamePath Like '/NASBA/%' AND CategoryEnabled = 1@).TopN(1)){ return @NASBA: @ } #%} {% foreach(cat in Documents[NodeAliasPath].Categories.Where(@CategoryNamePath Like '/NASBA/%' AND CategoryEnabled = 1@)){ if(x @= 1) { print(@, @); } x++; print(cat.CategoryDisplayName + IfCompare(cat.CategoryParentID, 19, @ (Non-Technical)@, @ (Technical)@)); }#%}@/p@
@/div@
@/div@
Here's the error message: Error while evaluating expression: foreach(cat in Documents[NodeAliasPath].Categories.Where(@CategoryNamePath Like '/NASBA/%' AND CategoryEnabled = 1@)){ if(x @= 1) { print(@, @); } x++; print(cat.CategoryDisplayName + IfCompare(cat.CategoryParentID, 19, @ (Non-Technical)@, @ (Technical)@)); }|(user)administrator|(hash)d202490aa4578353a98ad8394f1d577bf9cb712fcc7ed8b3fce4d90265a8120dCMS.MacroEngine.EvaluationException: Exception occured while evaluation of the expression 'foreach (cat in Categories.Where(@CategoryNamePath Like \'/NASBA/%\' AND CategoryEnabled = 1@)) { ... }': Enumerable object expected within foreach loop.I know the transformation works because I can see the proper output on our site in the repeater. I'm at a loss to determine what could be causing this exception. Any help would be appreciated.
↧