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

    I've got a getresources call that's only meant to return the first result that has a TV that's not empty. Problem is, it's returning any resource - regardless of whether the TV is empty. Here's my getResources call:
            [[getResources?
              &parents=`2`
              &tpl=`featuredImageChunk`
              &showHidden=`1`
              &limit=`1`
              &includeTVs=`1`  
              &tvFilters=`mainImage==%`
            ]]
    

    What could I be doing wrong?
      • 37377
      • 64 Posts
      What if you try this?:
      &tvFilters=`mainImage!=""`
        • 36435
        • 40 Posts
        Quote from: culd at Sep 01, 2015, 08:34 AM
        What if you try this?:
        &tvFilters=`mainImage!=""`

        Nope - I believe that would show all (or the first) resource with nothing in the TV.

        I even tried borrowing from your idea... This gave me the same result as my original problem...

        &tvFilters=`mainImage!=""`


        *Edit

        just noticed - I'd misread your earlier post... I thought you'd used &tvFilters=`mainImage==""`
          • 37377
          • 64 Posts
          Are the TV's really empty? What do they output in your chunk 'featuredImageChunk'?
            • 36435
            • 40 Posts
            Here's the content of the chunk:

            <div class="featured-main">
                <div class="bl-featured-big">
            		<img src="[[+tv.mainImage:pthumb=`w=1170&h=491&zc=1`]]" class="img-responsive" alt="" />
            		<div class="bl-info">
            		    <span>[[+publishedon:strtotime:date=`%b %d, %Y`]]</span>
            		    <h3><a href="[[~[[+id]]]]">[[+pagetitle]]</a></h3>
            		    <a class="rmore" href="[[~[[+id]]]]">Continue Reading <i class="fa fa-arrow-right"></i></a>
            		</div>
               </div>
            </div>

            Here's the output from an article without an image:
            <div class="featured-main">
                <div class="bl-featured-big">
                    <img src="" class="img-responsive" alt="" />
            		<div class="bl-info">
            		    <span>Sep 01, 2015</span>
            		    <h3><a href="entrep-news/2015/09/01/2015-women-entrepreneur-showcase-launched/">2015 Women Entrepreneur Showcase launched</a></h3>
            		    <a class="rmore" href="entrep-news/2015/09/01/2015-women-entrepreneur-showcase-launched/">Continue Reading <i class="fa fa-arrow-right"></i></a>
            		</div>
                </div>
            </div>

            So, it's still pulling this article, whereas, I'd like getResources to skip it and go to the next one, until it finds one with a mainImage.

            Once again, here's the getResources call I'm using:

            [[getResources?
                      &parents=`2`
                      &showHidden=`1`
                      &tpl=`featuredImageChunk`
                      &limit=`1`
                      &includeTVs=`1`
                      &tvFilters=`mainImage!=""`
                      &hideContainers=`1`
                    ]]
            

            and
            &tvFilters=`mainImage==%`


            I'm running out of hairs to pull out...
            • Is mainImage TV an image TV? If so, it's not really empty due to the fact that an image tv actually outputs the html for the image element.

              Use null in your filter instead of empty.
                Frogabog- MODX Websites in Portland Oregon
                "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                Having server issues? These guys have MODX Hosting perfected - SkyToaster
                • 36435
                • 40 Posts
                Quote from: frogabog at Sep 01, 2015, 03:11 PM
                Is mainImage TV an image TV? If so, it's not really empty due to the fact that an image tv actually outputs the html for the image element.

                Use null in your filter instead of empty.

                Hi Frogabog. How do I go about using null? Or rather, what's the syntax?
                • justimaging,

                  I have a thought you could try, as Frogabog is correct there is still and output even if it is blank. Try modifying your filter for the blank out put. so filter for: <img src /> . thus your filter would then work.