Saturday, November 19, 2011

Getting the TemplateRepeatIndex of an outer repeating region

When you need the TemplateRepeatIndex of an outer repeating region you can use the following code snippet:


@@Push("OuterTemplateRepeatIndex", ${(TemplateRepeatIndex == 0) ? (parseInt(OuterTemplateRepeatIndex) >= 0) ? parseInt(OuterTemplateRepeatIndex) +1 : 0 : parseInt(OuterTemplateRepeatIndex)})@@



Each time the TemplateRepeatIndex == 0 the OuterTemplateRepeatIndex will be increased with 1, unless it is not set, then I default to 0. For any other value of TemplateRepeatIndex I will reset the OuterTemplateRepeatIndex with itself.


(...)