We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19645
    • 23 Posts
    I´m wondering if it is possible to filter the output of Ditto with 2 different criterias from TVs associated with the documents). The basic filter allows to set more then one filter but they are connected with OR. (tv1,50,2|tv2,52,2 will show any document where tv1 is 50 OR tv2 is 61) What I would need is something like this: show all docs where tv1 is 50 AND tv2 is 61

    How can I achieve this with help of costums filters?

    Thank you.
      • 1122
      • 209 Posts
      You only need to consider Boole’s arithmetics a bit:
        negation(negation(A)) = A
      
        negation(negation((tv1 is 50) AND (tv2 is 61))) = negation((tv1 is not 50) OR (tv2 is not 61)) = negation(tv1,50,1|tv2,61,1)
      

      "tv1,50,1|tv2,61,1" is your seeking formula because it is just negation what Ditto’s filter actually does -- it throws out (instead of returning) elements that meet described criteria thus leaving you with those remaining. (q.e.d.)

      In other words, to _obtain_ subset of elements that meets criterion1 AND criterion2 AND ... you need to _throw out_ subset that meets not(criterion1) OR not(criterion2) OR ... -> subset + negation(subset) = full set