We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51867
    • 19 Posts
    Hi

    I am currently trying to add an &where to my GetImageList call, so that only items that are in the future are shown (this is to list shows for artists, so shows that are in the past should not be shown).

    I have downloaded the getDate snippet, but I cannot work out how to filter my migx items so that it checks against the current date and does not show if the item is in the past.

    Any help would be greatly appreciated.

    Andy

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

      • 4172
      • 5,888 Posts
      what is the output of the getDate-snippet?
      Is it a unix-timestamp or is it formatted somehow?

      If unix-timestamp, then try:

      &where=`{"date:>=":"[[!getDate:date=`%Y-%m-%d %H:%M:%S`]]"}`


      Hint:
      If you have many shows for each artist in the future, I would suggest to create a custom-table and use a MIGXdb-TV instaed of a MIGX-TV
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 51867
        • 19 Posts
        Hi Bruno

        I have now got a snippet I have titled GetTodaysDate that looks like this:

        <?php
        $date = strftime('%x');
        return $date;
        


        This returns todays date, in the same format as I am currently displaying it. However, if I use the &where filter nothing shows for any artists at all. The field name for the field I want to check against is 'Date' and it is using a TV called 'OnlyDate' (this is because I did not want to have to input a time for every show as well, as this is not needed).

        This is my &where query:

        &where=`{"Date:>=":"[[GetTodaysDate]]"}`

        I have also tried using OnlyDate instead of date, and nothing works. It either shows all of the shows, no matter if they are in the past or not, or nothing at all.

        Andy
          • 4172
          • 5,888 Posts
          could you post the whole json-string of all items of your MIGX-TV, please

            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 51867
            • 19 Posts
            This is what comes up when I edit raw and view Form Tabs, is this what you are after?

            [{"MIGX_id":7,"caption":"Shows","print_before_tabs":"0","fields":[{"MIGX_id":14,"field":"Location","caption":"Town\/City","description":"","description_is_code":"0","inputTV":"","inputTVtype":"text","validation":"","configs":"","restrictive_condition":"","display":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":"","useDefaultIfEmpty":"0","pos":1},{"MIGX_id":15,"field":"Venue Name","caption":"Venue Name","description":"","description_is_code":"0","inputTV":"","inputTVtype":"text","validation":"","configs":"","restrictive_condition":"","display":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":"","useDefaultIfEmpty":"0","pos":2},{"MIGX_id":16,"field":"Date","caption":"Date","description":"","description_is_code":"0","inputTV":"OnlyDate","inputTVtype":"","validation":"","configs":"","restrictive_condition":"","display":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":"","useDefaultIfEmpty":"0","pos":3},{"MIGX_id":17,"field":"Ticket Link","caption":"Ticket Link","description":"","description_is_code":"0","inputTV":"","inputTVtype":"text","validation":"","configs":"","restrictive_condition":"","display":"","sourceFrom":"config","sources":"","inputOptionValues":"","default":"","useDefaultIfEmpty":"0","pos":4}],"pos":1}]

            Andy
              • 4172
              • 5,888 Posts
              no, I was talking about the MIGX - items.

              you can see them, by adding the TV-tag of your MIGX-TV to your template:

              [[*yourMIGXtv]]
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 51867
                • 19 Posts
                Hello

                Sorry for the long period of time between my replies, I have been working on other projects.

                I have tried [[*Shows]] and [[*shows]] (this is the name of the MIG-X item I think, but nothing is happening when this is put into my template.

                This is pretty much the last thing I need to do for this site, but its pretty integral so any help would be great.

                Andy
                  • 51867
                  • 19 Posts
                  Sorry, it has worked now (not sure why it was not working before, maybe a caching issue).

                  I think the issue is that the TV is still registering the time as well as the date, even though I am only asking for the date to be put in?

                  Here is what comes up:


                  [{"MIGX_id":"9","Location":"London","Venue Name":"Barfly","Date":"2016-06-30 16:18:00","Ticket Link":"","RenderDate_ro":"{\"idx\":0,\"_renderer\":\"this.renderChunk\",\"_renderchunktpl\":\"\\n\"}","_this.value":"","RenderDate":"30/06/16\n"},{"MIGX_id":"8","Location":"Birmingham","Venue Name":"Asylum 2","Date":"2016-06-29 16:17:23","Ticket Link":"","RenderDate_ro":"","_this.value":"29/06/16\n","RenderDate":"29/06/16\n"},{"MIGX_id":"7","Location":"Leeds","Venue Name":"The Key Club","Date":"2016-06-28 16:16:42","Ticket Link":"","RenderDate_ro":"","_this.value":"28/06/16\n","RenderDate":"28/06/16\n"},{"MIGX_id":"6","Location":"Newcastle","Venue Name":"Think Tank","Date":"2016-06-27 16:16:15","Ticket Link":"","RenderDate_ro":"","_this.value":"27/06/16\n","RenderDate":"27/06/16\n"},{"MIGX_id":"5","Location":"Glasgow","Venue Name":"The Attic @ Garage","Date":"2016-06-25 16:15:50","Ticket Link":"","RenderDate_ro":"","_this.value":"25/06/16\n","RenderDate":"25/06/16\n"},{"MIGX_id":"4","Location":"Nottingham","Venue Name":"Bodega","Date":"2016-06-24 16:15:16","Ticket Link":"","RenderDate_ro":"","_this.value":"24/06/16\n","RenderDate":"24/06/16\n"},{"MIGX_id":"3","Location":"Bristol","Venue Name":"Louisiana","Date":"2016-06-23 16:14:57","Ticket Link":"","RenderDate_ro":"","_this.value":"23/06/16\n","RenderDate":"23/06/16\n"},{"MIGX_id":"2","Location":"Southampton","Venue Name":"Joiners","Date":"2016-06-22 16:13:52","Ticket Link":"","RenderDate_ro":"","_this.value":"22/06/16\n","RenderDate":"22/06/16\n"},{"MIGX_id":"1","Location":"London","Venue Name":"Old Blue Last","Date":"2016-04-22 16:11:56","Ticket Link":"https://tickets.songkick.com/events/26199534","RenderDate_ro":"","_this.value":"22/04/16\n","RenderDate":"22/04/16\n"}]

                  Andy
                    • 51867
                    • 19 Posts
                    I have tried this instead, but with no luck:

                    [[
                    !getImageList:default=`<p>No Upcoming Shows</p>`?
                    &tvname=`Shows`
                    &tpl=`showsTpl`
                    &where=`{"RenderDate:>=":"[[GetTodaysDate]]"}`
                    ]]


                    I have also tried changing the GetTodaysDate snippet so that it outputs the same as RenderDate ("DD/MM/YY\n") but nothing is working. It either shows all of the shows, including those in the past, or it shows no shows at all.

                    Andy [ed. note: shmalloway last edited this post 10 years, 4 months ago.]
                    • discuss.answer
                      • 4172
                      • 5,888 Posts
                      your snippet has to be like that:
                      $date = strftime('%Y-%m-%d');
                      return $date;
                      


                      and you have to call it like that:

                      &where=`{"Date:>=":"[[!GetTodaysDate]]"}`
                      


                      That's working for me with your TV-Value.

                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!