We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21502
    • 16 Posts
    Say I have two TVs created that have constrained values:

    TV1 with values A,B,C
    TV1 with values X,Y,Z

    I want to create a query that brings back the document IDs where (TV1=A OR B) AND TV2=Z. Can I do that with Ditto? I’m thinking I need PHx as well.

    Any ideas?

    TIA
      • 1122
      • 209 Posts
      Something of this kind should solve your task:
      [[Ditto? &parent=`...` ... &tpl=`query` ...]]
      
      "query" chunk:
      [+phx:if=`[+TV1+]`:is=`A`:or:is=`B`:then=`[+phx:if=`[+TV2+]`:is=`Z`:then=`[+id+]`:else=``+]`:else=``+]
      
        • 21502
        • 16 Posts
        Cool, we’ll give that a try. Thanks!