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 -->   
2
  • Can you confirm that you're using the DGX? Mar 20, 2014 at 13:26
  • @NickoliRoussakov yes i am using DGX and its working very fine. Mar 20, 2014 at 13:33

1 Answer 1

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 :)

3
  • 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/… Mar 20, 2014 at 19:03
  • Can we use XSLT TBB ?? if yes , can you please provide some thoughts. Mar 23, 2014 at 8:26
  • 1
    Sure, you can use document() in XSLT to reference other components. See an example from Chris Summers. Mar 24, 2014 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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