1

I am writing a DWT TBB to get field value of multi level component link field. I have a component having componentlink field("list") and in those component i have another component link field("management"). Both componentLink fields are multivalued. I need to iterate those fields. But its not rendering the desired output may be because of misinterpretation of TemplateRepeatIndex. Did someone encounter this scenario.

Title of the component : @@title@@
<!-- TemplateBeginRepeat name="list" -->   
    <li class="accordion-item">
    <a href="#" class="accordion-link">@@Get("Fields.list[${TemplateRepeatIndex}].title")@@</a>
    <div class="board-members">
            <!-- TemplateBeginRepeat name="@@Get("Fields.list[${TemplateRepeatIndex}].management")@@" -->   
                <div class="member">
                    <h4>@@Get("Fields.list.management[${TemplateRepeatIndex}].designation")@@</h4>
                    <p class="intro">@@Get("Fields.list.management[${TemplateRepeatIndex}].intro")@@</p>
                    @@Get("Fields.member[${TemplateRepeatIndex}].description")@@    
                </div>
            <!-- TemplateEndRepeat -->   
    </div>  
    </li>

<!-- TemplateEndRepeat -->   
  • Can you confirm that you're using the DGX? – Nickoli Roussakov Mar 20 '14 at 13:26
  • @NickoliRoussakov yes i am using DGX and its working very fine. – AmateurCoder Mar 20 '14 at 13:33
4

You are right; If there is a loop in a loop the counters are not stored of the outer loop(s);

TemplateRepeatCount
TemplateRepeatIndex

If you want to resolve this you can build a Custom Function (login required, Tridion 2011 documentation)

Or switch to the Razor Mediator that does support this kind of functionality out of the box :)

| improve this answer | |
  • Or build a simple c# TBB to fetch the field values and place them on the package, or use the nested component template technique as described here: tridiondeveloper.com/… – Nickoli Roussakov Mar 20 '14 at 19:03
  • Can we use XSLT TBB ?? if yes , can you please provide some thoughts. – AmateurCoder Mar 23 '14 at 8:26
  • 1
    Sure, you can use document() in XSLT to reference other components. See an example from Chris Summers. – Alvin Reyes Mar 24 '14 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.