<![CDATA[ &where comparator not working in getimagelist - MODX Community Forums]]> https://forums.modx.com/thread/?thread=102750 <![CDATA[&where comparator not working in getimagelist]]> https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553421
[[!getImageList?
&tvname=`HeaderTV`
&tpl=`BannerSliderElementMIGX`
&where='{"5:=":"5"}'
]]

That unpublishes everything, seems like the where statement is returning false.

Note that this is just for a test. I have tried this with my actual TVs and chunks and no matter what I put in the where field, everything gets unpublished.]]>
aarond Aug 29, 2017, 08:07 PM https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553421
<![CDATA[Re: &where comparator not working in getimagelist]]> https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553630 aarond Sep 05, 2017, 02:40 PM https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553630 <![CDATA[Re: &where comparator not working in getimagelist]]> https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553549
Try not to use conditionals, if there are other/better solutions.]]>
Bruno17 Sep 02, 2017, 05:44 AM https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553549
<![CDATA[Re: &where comparator not working in getimagelist]]> https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553543 Quote from: Bruno17 at Sep 01, 2017, 05:45 PM
and I would do it this way:

                        [[!getImageList?
                            &tvname=`HeaderTV`
                            &tpl=`BannerSliderElementMIGX`
                            &where=`{"unpublishdate:>":"[[!today_date]]"}`
                            &emptyTpl=`@CODE:<div class="swiper-slide"><img src="sites/common/media/banner/med_hat_library08.jpg" alt="Shortgrass Library System"></div>`
                        ]]


Would you use this in place of the entire if/else statement?]]>
aarond Sep 01, 2017, 10:27 PM https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553543
<![CDATA[Re: &where comparator not working in getimagelist (Best Answer)]]> https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553540
                        [[!getImageList?
                            &tvname=`HeaderTV`
                            &tpl=`BannerSliderElementMIGX`
                            &where=`{"unpublishdate:>":"[[!today_date]]"}`
                            &emptyTpl=`@CODE:<div class="swiper-slide"><img src="sites/common/media/banner/med_hat_library08.jpg" alt="Shortgrass Library System"></div>`
                        ]]

]]>
Bruno17 Sep 01, 2017, 05:45 PM https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553540
<![CDATA[Re: &where comparator not working in getimagelist]]> https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553539
[{"MIGX_id":"1","image":"banners/Antelope_NewWeb-01.jpg","image_link":"","image_alt_text":"","unpublishdate":"","butt1":"","butt1url":"--"},{"MIGX_id":"2","image":"banners/Gale_NewWeb-01.jpg","image_link":"","image_alt_text":"","butt1":"","butt1url":"","butt2":"","butt2url":""},{"MIGX_id":"3","image":"banners/Hoopla_NewWeb-01.jpg","image_link":"","image_alt_text":"","butt1":"","butt1url":"","butt2":"","butt2url":""}]


seems there isn't a unpublishdate, only the first item has a unpublishdate, but this is empty?]]>
Bruno17 Sep 01, 2017, 05:40 PM https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist?page=2#dis-post-553539
<![CDATA[Re: &where comparator not working in getimagelist]]> https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist#dis-post-553531
The code in reply#8 does not work, even with my removal of migx_id4 from the syntax.

[[*HeaderTV]] gives me this:

[{"MIGX_id":"1","image":"banners/Antelope_NewWeb-01.jpg","image_link":"","image_alt_text":"","unpublishdate":"","butt1":"","butt1url":"--"},{"MIGX_id":"2","image":"banners/Gale_NewWeb-01.jpg","image_link":"","image_alt_text":"","butt1":"","butt1url":"","butt2":"","butt2url":""},{"MIGX_id":"3","image":"banners/Hoopla_NewWeb-01.jpg","image_link":"","image_alt_text":"","butt1":"","butt1url":"","butt2":"","butt2url":""}]

Here is the code from my banner_test chunk(where the variable call resides):

<div class="kode-banner" style="z-index: -1;">
    <div class="bxslider">
        <div class="swiper-container-slider">
            <!-- Additional required wrapper -->
            <div class="swiper-wrapper">
                <!-- Slides -->
                [[*HeaderTV:is=null:then=`
                    <div class="swiper-slide"><img src="sites/common/media/banner/med_hat_library08.jpg" alt="Shortgrass Library System"></div>
                `:else=`
                        [[!getImageList?
                            &value=`[{"MIGX_id":"1","unpublishdate":"2017-08-30 13:32:00"},{"MIGX_id":"2","unpublishdate":"2017-09-02 13:32:00"},{"MIGX_id":"3","unpublishdate":"2017-09-03 13:32:00"}]`
                            &where=`{"unpublishdate:>":"[[!today_date]]"}`
                        ]]
                      [[*HeaderTV]]
                `]]
            </div>


            <!-- If we need pagination -->
            <div class="swiper-pagination"></div>
        </div>
    </div>
</div>
]]>
aarond Sep 01, 2017, 02:35 PM https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist#dis-post-553531
<![CDATA[Re: &where comparator not working in getimagelist]]> https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist#dis-post-553515 That's the same, as you would give a tvname with the name of your MIGX-TV, actually.

See, what you get with

[[*HeaderTV]]


and post it here. Then, I can test against your items on my end.
]]>
Bruno17 Sep 01, 2017, 05:00 AM https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist#dis-post-553515
<![CDATA[Re: &where comparator not working in getimagelist]]> https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist#dis-post-553503
The snippet you provided won't work for me in a live environment, however. This migx template variable that were are calling is accessable to content creators in order to add rotating banners on a slider, it won't always have a static number of things in the array.]]>
aarond Aug 31, 2017, 08:53 PM https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist#dis-post-553503
<![CDATA[Re: &where comparator not working in getimagelist]]> https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist#dis-post-553497
[[!getImageList?
&value=`[{"MIGX_id":"1","unpublishdate":"2017-08-30 13:32:00"},{"MIGX_id":"2","unpublishdate":"2017-09-02 13:32:00"},{"MIGX_id":"3","unpublishdate":"2017-09-03 13:32:00"},{"MIGX_id":"4","unpublishdate":"2017-08-20 13:32:00"}]`
&where=`{"unpublishdate:>":"[[!today_date]]"}`
]]


and that's working for me. Which Version of MIGX are you at?]]>
Bruno17 Aug 31, 2017, 05:37 PM https://forums.modx.com/thread/102750/where-comparator-not-working-in-getimagelist#dis-post-553497