We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51590
    • 3 Posts
    I have a getResources call, the result looks more or less like this:

    • 01.01.2016 - new year's lunch (meetings)
    • 11.12.2015 - writing class (classes)
    • 01.12.2015 - trip to London (trips)
    • 23.11.2015 - french class (classes)

    I can sort them by tags:

    • classes
    • meetings
    • trips

    It works very well. This is my code:

               [[!getResourcesTag?
      						&parents=2`  
      						&tagKey=`Tags` 
      						&showHidden=`1`
      						&tpl=`datesTpl
      						&limit=`3`
      						&includeContent=`1`
      						&includeTVs=`1`
      						&processTVs=`1`
      						&tvPrefix=`` 
      						&hideContainers=`1`
      						&pageLimit=`10`	
    					]]


    Now comes the part, that makes problems to me. I want to group the result by month. So the result I would like to achieve is:

    January 2016
    ---------------

    • 01.01.2016 - new year's lunch (meetings)

    December 2015
    ------------------

    • 11.12.2015 - writing class (classes)
    • 01.12.2015 - trip to London (trips)

    November 2015
    ------------------

    • 23.11.2015 - french class (classes)


    The TV, that outputs the date has the name "date". This TV gives me for every entry a timestamp output. For example: "2015-12-11 00:56:00".
    I wrote a snippet (formatDate), that outputs me later the format I wish. I use it like this:
    [[formatDate? &date=`[[+date]]`]]


    So I thought I could use Archivist Grouper for that issue. But it is not working. Somehow it doesn't process my TVs. Here is my code:
    [[!ArchivistGrouper? &parents=`2` &itemTpl=`datesTpl` &includeTVs=`1` &tvPrefix=`` &includeContent=`1` &processTVs=`1`]]


    My result with Archivist Grouper is:

    January 2016
    ---------------

    • 01.01.2016 - new year's lunch ()

    December 2015
    ------------------

    • 01.01.2016 - writing class ()
    • 01.01.2016 - trip to London ()

    November 2015
    ------------------

    • 01.01.2016 - french class ()

    So my question is, can I get the result I wish also with getResources? Or do you have any idea to get it run! I hope very much you can help. I am happy for every hint smiley
      • 51590
      • 3 Posts
      Addition: Also the TVfilter is not working with getResourcesTag
        • 34174
        • 67 Posts
        No one had an answer for this?
          • 3749
          • 24,544 Posts
          I don't think there's a way to set a group by call with getResources. You might be able to use a separate getResources call for each group, but the most efficient way would be a custom snippet.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting