We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18830
    • 161 Posts
    I have a doc structure like this

    item1
    |–subitem with tv "genre" value = 1
    |–subitem with tv "genre" value = 1
    |–subitem with tv "genre" value = 2
    |–subitem with tv "genre" value = 1
    item2
    |–subitem with tv "genre" value = 2
    |–subitem with tv "genre" value = 2
    |–subitem with tv "genre" value = 1
    item3
    |–subitem with tv "genre" value = 2



    and so on and I’m using nested Ditto calls.

    The first:

    Here goes the table header
    [[Ditto? &id=`1`  &parent=`20` &tpl=`secondcall`  &sortBy=`pagetitle` &sortDir=`ASC` &noResults=` `   ]]



    At the second Ditto call I use the &filter parameter so that it will display only subitems with tv value == 1:

    <tr><td>[+longtitle+]</td>
    [!Ditto?    &id=`2` &parents=`[+id+]` &summarize=`15` &hiddenFields=`genre`  &filter=`genres,2,2` &tpl=`detail` &sortBy=`pagetitle` &sortDir=`ASC` &noResults=` ` !]


    Chunk "detail"

    <tr><td>[+pagetitle+]</td></tr>



    This gives a table like this



    item1 	subitem with tv value = 1
    	subitem with tv value = 1
    	subitem with tv value = 1
    item2 	subitem with tv value = 1
    item3



    Of course I don’t want item3 to be shown. Is there a way to achieve this with Ditto? And how can I count the number of the subitems that will be shown, because I need there number to set rowspan value at the HTML table. Or should I use a custom script?

    Thank you so much.