We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24981
    • 109 Posts
    I think I might be missing something obvious here, but this is what I’m trying to do...

    I am creating a list of Speakers and a list of Events.

    When I set up an event I want to select from a checkbox which speakers will speak at the event. I’ve create a TV with checkboxes for the docID for each speaker. Now what I want is Ditto to list only those speakers that are selected in the checkboxes.

    I managed to get the filter delimiter output working by using:
    &filter=`id,[*EventSpeakers*],2`

    and setting the delimiter in the TV as:
    ,2|id,


    But of course this excludes those selected. And I can’t get the filter to work to INCLUDE ... Am I missing a simple way to do this?

    [I don’t want to do this by setting tags in the Speaker pages as this would not be a good UI because it would require going into each speakers page when setting up a new event.]

    Richard
      • 11975
      • 2,542 Posts
      Hi,

      In fact you have to think about filters in the opposite way.

      You want to remove docs where speakers is not equal to the value you’re looking for.`
      So the filter will be 1 or 7.

      &filter=`id:[*speakers*]:1` if you can have multiple values for speakers use the filter 7
      &localFilterDelimiter=`:`
      &tagDelimiter=`,`

      The tv must have as widget delimited list ’,’

      Hope that helps


      :-)
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 18397
        • 3,250 Posts
        This should work: &filter=`id,[*EventSpeakers*]`
          • 20765
          • 90 Posts
          myfriendscallmebill Reply #4, 19 years, 6 months ago
          Quote from: Mark at Apr 01, 2007, 09:29 AM

          This should work: &filter=`id,[*EventSpeakers*]`

          (1) What does it mean to have a filter without a mode?

          (2) What do the asterisks mean? I thought that placeholders for all document fields and TVs have to use plus signs, but then this is in a parameter so maybe the rules are different...?
            • 11975
            • 2,542 Posts
            Hi,

            1/ default mode in ditto is 1
            2/ In this example we need the value of the current doc (from which the ditto call is done)

            :-)
              Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
              • 20765
              • 90 Posts
              myfriendscallmebill Reply #6, 19 years, 6 months ago
              Quote from: heliotrope at Apr 01, 2007, 10:46 AM

              1/ default mode in ditto is 1
              TH
              Quote from: heliotrope at Apr 01, 2007, 10:46 AM

              2/ In this example we need the value of the current doc (from which the ditto call is done)
              So can I put a MODx tag for any doc field, TV, etc or even an @EVAL in the second position?

              And is the first position in the filter still limited to just document field names?
                • 11975
                • 2,542 Posts

                So can I put a MODx tag for any doc field, TV, etc or even an @EVAL in the second position?

                I don’t think the MODx tag will be parsed when called within an @BINDINGS


                And is the first position in the filter still limited to just document field names?

                The filters are available for TVs and dcoument fields.

                :-)
                  Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                  • 24731 ☆ A M B ☆
                  • 211 Posts
                  Hi there, I am not sure what I could be doing wrong, I have almost exactly same case but the filter does not seem to be working. This is what I am trying:

                  [[Ditto? &format=`html` &parents=`303` &depth=`2` &display=`3` &tpl=`NewsHomePage` &hideFolders=`1` &sortDir=`DESC` &sortBy=`createdon` &filter=`tvNewsCat, 'dr', 8`]]


                  This is what I expect:

                  I have a News section where all my news documents are contained and organized. I created a TV so I can assign to each document a "Category". I did this with checkboxes and set the widget for the TV to be a delimited list ",". One news can belong to several categories.

                  I am trying to get on the homepage the three latest entries which match X category. In the code above dr is a category value for Dominican Republic (Dominican Republic==dr||London==uk)

                  I am always getting displayed all documents regardless of what I select inside each one as categories sad.

                  Any clues?

                  Thanks.
                    • 24731 ☆ A M B ☆
                    • 211 Posts
                    Hi again, I got it working by using a different delimiter in the request. This is the code that worked:

                    [[Ditto? &format=`html` &parents=`303` &depth=`2` &display=`3` &tpl=`NewsHomePage` &hideFolders=`1` &sortDir=`DESC` &sortBy=`createdon` &localFilterDelimiter=`:` &filter=`tvNewsCat:dr:7`]]


                    One thing that got me confused is:

                    Before I was using 8 instead of 7 since I had seen here:

                    http://ditto.modxcms.com/files/snippet-ditto-php.html#filter

                    It says:

                    Mode Meaning
                    1 !=
                    2 ==
                    3 <
                    4 >
                    5 <=
                    6 >=
                    7 Text not in field value
                    8 Text in field value

                    So unless I’ve drank too much diet coke, 7 and 8 values are mistaken, should be the other way around, NO?

                    Unless filter actually means EXCLUDE matched entries instead of what I originally thought. But is this is the case, then the filter description is missleading:

                    Only show items meeting a criteria Use in the format field,criteria,mode with the comma being the local delimiter

                    Should I stop drinking coke? or does this make sense to anyone? hehe

                    Jose R. Lopez
                      • 25663 MODX Staff
                      • 12,272 Posts
                      There’s actually been a discussion of changing the parameter name to &filterOut. It can indeed be confusing.
                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me