We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46876
    • 23 Posts
    Hello again!

    I have a very simple question regarding about the MIGX LoopCollection snippet.

    [[!migxLoopCollection? 
    &packageName=`redaseventspackage`
    &classname=`redasEventsPackage`
    &sortConfig=`[{"sortby":"datestart","sortdir":"ASC"}]`
    &where=`{"resource_id":"62","dateend:>":"[[!GetDate:date=`%Y-%m-%d`]]"}`
    &limit=`3`
    &tpl=`displayEventsRow`]]
    


    Under the '&where' parameter, I'd like to search 'resource_id' using two values instead of one. Does anyone know what is the syntax for the '&where' parameter to add an 'OR' clause or to allow the use of multiple values/range of values to search within a column?

    E.g. MySQL Syntax: 'WHERE resource_id = 62 OR resource_id = 63;' instead of 'WHERE resource_id = 62' only.

    Thanks!


    UPDATE: I found out about putting 'OR' in "OR:resource_id":"63" but strangely this does not return any values.

    [[!migxLoopCollection? 
    &packageName=`redaseventspackage`
    &classname=`redasEventsPackage`
    &sortConfig=`[{"sortby":"datestart","sortdir":"ASC"}]`
    &where=`{"resource_id":"62","OR:resource_id":"63","dateend:>":"[[!GetDate:date=`%Y-%m-%d`]]"}`
    &limit=`3`
    &tpl=`displayEventsRow`]]
    

    This question has been answered by Bruno17. See the first response.

    [ed. note: xuthiensun last edited this post 12 years, 7 months ago.]
    • discuss.answer
      • 4172
      • 5,888 Posts
      try:
      &where=`{"resource_id:IN":[62,63],"dateend:>":"[[!GetDate:date=`%Y-%m-%d`]]"}`
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 46876
        • 23 Posts
        That did the trick. Thank you once again, Bruno!