We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40131
    • 40 Posts
    Can someone explain why this statement does not work, since RAW values are used, and the values of autoTag TV is just comma delimited list

    &tvFilters=`mytv==%,[[*id]],% || mytv==[[*id]],% || mytv==%,[[*id]] || mytv==[[*id]]`


    In theory this could solve all these acrobatics discussed above.
    In my case I do not want to modify the contents of "mytv" to add extra delimiters since I am using this TV in various ways and need to be "as is" - just comma list. [ed. note: nickyz last edited this post 11 years, 11 months ago.]
      • 40131
      • 40 Posts
      Quote from: nickyz at Jan 15, 2013, 08:53 AM
      Can someone explain why this statement does not work, since RAW values are used, and the values of autoTag TV is just comma delimited list

      &tvFilters=`mytv==%,[[*id]],% || mytv==[[*id]],% || mytv==%,[[*id]] || mytv==[[*id]]`


      In theory this could solve all these acrobatics discussed above.
      In my case I do not want to modify the contents of "mytv" to add extra delimiters since I am using this TV in various ways and need to be "as is" - just comma list.

      Hi there, I have tried something maybe stupid, but it seems to work!!
      in the statement above I replaced the comma with single pipe "|" character and the logic works out of the box!!

      &tvFilters=`mytv==%|[[*id]]|% || mytv==[[*id]]|% || mytv==%|[[*id]] || mytv==[[*id]]`


      I hope this is not a bug, but if it is, its a nice one smiley
        • 20215
        • 144 Posts
        Quote from: Bruno17 at Oct 26, 2012, 08:54 AM
        you could also make sure to have '||' at front and at end of the list in your TV

        ||25||26||30||40||

        then you could use
        &tvFilters=`list.top10.categories==%||[[*id]]||%`

        Hi all,

        i have a TV type superBoxselect (think it's the same as using the multi-select) to delimit the beginning and the end of the list i created a Custom Output that returns ||6||7||8||9|| or ,6,7,8,9, depending on the chosen delimiter.

        but in the database is stored only in this way 6||7||8||9
        don't save the processed data with the Output option!

        So &tvFilters=`myTV==%||6||%` fails!

        i would not use a TV-type text and manually enter a list of IDs

        could find another solution?
          ----------------------------------
          canale irc Italiano #modx server: tophost.azzurra.org
          • 36613
          • 328 Posts
          Quote from: mopmodx at Jan 22, 2013, 09:46 AM
          Quote from: Bruno17 at Oct 26, 2012, 08:54 AM
          you could also make sure to have '||' at front and at end of the list in your TV

          ||25||26||30||40||

          then you could use
          &tvFilters=`list.top10.categories==%||[[*id]]||%`

          Hi all,

          i have a TV type superBoxselect (think it's the same as using the multi-select) to delimit the beginning and the end of the list i created a Custom Output that returns ||6||7||8||9|| or ,6,7,8,9, depending on the chosen delimiter.

          but in the database is stored only in this way 6||7||8||9
          don't save the processed data with the Output option!

          So &tvFilters=`myTV==%||6||%` fails!

          i would not use a TV-type text and manually enter a list of IDs

          could find another solution?

          Anyone resoved the problem ? My problem there is related product in modx, but don't found the solution.
            • 37247 ☆ A M B ☆
            • 11 Posts
            Quote from: cristianb88 at Jul 08, 2014, 10:21 AM
            Quote from: mopmodx at Jan 22, 2013, 09:46 AM
            Quote from: Bruno17 at Oct 26, 2012, 08:54 AM
            you could also make sure to have '||' at front and at end of the list in your TV

            ||25||26||30||40||

            then you could use
            &tvFilters=`list.top10.categories==%||[[*id]]||%`

            Hi all,

            i have a TV type superBoxselect (think it's the same as using the multi-select) to delimit the beginning and the end of the list i created a Custom Output that returns ||6||7||8||9|| or ,6,7,8,9, depending on the chosen delimiter.

            but in the database is stored only in this way 6||7||8||9
            don't save the processed data with the Output option!

            So &tvFilters=`myTV==%||6||%` fails!

            i would not use a TV-type text and manually enter a list of IDs

            could find another solution?

            Anyone resoved the problem ? My problem there is related product in modx, but don't found the solution.

            I ran into a similar problem and found a (brute) workaround for filtering IDs reliably. The following code couldn't distinguish between an ID of "20" and an ID of "203" (remember the wildcards in "%[[*id]]%" are needed for lists of IDs!):

            &tvFilters=`[[*relatedassetsTemplatevariableTV]]==%[[*id]]%`


            So I came up with this:

            &tvFilters=`[[*relatedassetsTemplatevariableTV]]==%[[*id]]%,[[*relatedassetsTemplatevariableTV]]!=%0[[*id]]%,[[*relatedassetsTemplatevariableTV]]!=%1[[*id]]%,[[*relatedassetsTemplatevariableTV]]!=%2[[*id]]%,[[*relatedassetsTemplatevariableTV]]!=%3[[*id]]%,[[*relatedassetsTemplatevariableTV]]!=%4[[*id]]%,[[*relatedassetsTemplatevariableTV]]!=%5[[*id]]%,[[*relatedassetsTemplatevariableTV]]!=%6[[*id]]%,[[*relatedassetsTemplatevariableTV]]!=%7[[*id]]%,[[*relatedassetsTemplatevariableTV]]!=%8[[*id]]%,[[*relatedassetsTemplatevariableTV]]!=%9[[*id]]%,[[*relatedassetsTemplatevariableTV]]!=%[[*id]]0%,[[*relatedassetsTemplatevariableTV]]!=%[[*id]]1%,[[*relatedassetsTemplatevariableTV]]!=%[[*id]]2%,[[*relatedassetsTemplatevariableTV]]!=%[[*id]]3%,[[*relatedassetsTemplatevariableTV]]!=%[[*id]]4%,[[*relatedassetsTemplatevariableTV]]!=%[[*id]]5%,[[*relatedassetsTemplatevariableTV]]!=%[[*id]]6%,[[*relatedassetsTemplatevariableTV]]!=%[[*id]]7%,[[*relatedassetsTemplatevariableTV]]!=%[[*id]]8%,[[*relatedassetsTemplatevariableTV]]!=%[[*id]]9%`


            In my example [[*relatedassetsTemplatevariableTV]] holds the TV to compare with (depending on the page where it is called by [[getResources]]), which is either a TV that holds one ID or a list of IDs, delimited with ",".

            See it working live: http://www.sounddirect.at/sheila-fernandez-fooled-again-single/. [ed. note: gernot_ebenlechner last edited this post 9 years, 11 months ago.]
              • 36613
              • 328 Posts
              I resolve this problem with this sintax:

              [[!migxLoopCollection?
                  &classname=`modTemplateVarResource`
                  &where=`{"tmplvarid":"20","1":[
                          {"value":"[[*id]]"},
                          {"OR:value:LIKE":"%||[[*id]]||%"},
                          {"OR:value:LIKE":"[[*id]]||%"},
                          {"OR:value:LIKE":"%||[[*id]]"}
                          ]}`
                  &tpl=`@CODE:[[+contentid]]`
                  &outputSeparator=`,`
                  &toPlaceholder=`resource_ids`
                  &debug=`0`
              ]]
              
              [[!getResources?
              &parents=`[[++products_id]]`
              &tpl=`childItemRow`
              &depth=`0`
              &limit=`150`
              &includeTVs=`1`
              &includeTVList=`imgsanteprima` 
              &includeContent=`1`
              &sortby=`{"menuindex":"ASC","publishedon":"ASC"}`
              &where=`{"id:IN":[ [[!+resource_ids]] ]}`
              ]]