We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25201
    • 94 Posts
    Am trying to filter out duplicates from a ditto aggregation and am hopeful someone can put me on the right track. In my structure am retrieving child documents indicated by a flag TV, but only want one parent document to be returned, not all the children. Currently am doing this by means of a ditto filter: &filter=`tv_flag,yes,7`

    Then in the ditto template retrieve the parent document with a snippet call. This returns all the children matching the tv_flag condition, but as they all point to the same parent, creates redundant documents. So am looking for a way to filter out the duplicates. A solution would be if I could stop ditto aggregation after the first flag hit.

    Anyone have a hint?

    Thanks!
      • 26931
      • 2,314 Posts
      Hi rnd,

      not sure, but maybe Dittos Distinct Extender can help:
      http://modxcms.com/forums/index.php?topic=23932.0
      http://modxcms.com/extras/package/95
        • 25201
        • 94 Posts
        Thanks for that pointer, can’t use it directly, but puts me on the extenders track.
          • 25201
          • 94 Posts
          Ah, that did it, changed the distinct extender code to look for an already used parent id with modx->getParent(id,1,’id’);

          Great