Question

I have document type Product with fields: image and text. I would like to add webpart to kentico with CMS repeater that show all documents Product, but I would like show only documents that contain images (field image is not necessary). I have added line

WhereCondition="Image is not null"

to cmsrepeater and on my local computer it works - I can see only items with images. But when I move my files to the staging it is a problem, I can see empty places where should be an image so my method doesn't work but I don't know why... Any ideas?

All of my code:

<cms:CMSRepeater ID="rptProducts" runat="server"
                 Path="/Products/%" 
                 ClassNames="Products.Item" 
                 TransformationName="Product.ProductList"
                 SelectOnlyPublished="true" 
                 StopProcessing="true"
                 PagerControl-PageSize ="4"
                 PagerControl-PageNumbersSeparator=""
                 PagerControl-BackNextStyle="display:none;"
                 EnablePaging="true"
                 ZeroRowsText='<%# CMS.GlobalHelper.ResHelper.GetString("ZeroRowsText") %>' 
                 WhereCondition="Image is not null" 
    />

I've checked and my site on staging isn't cached and all files are correct.

Was it helpful?

Solution

Depending on the constraints on the Image field of the Product document type, is it possible the column contains blank values rather than null's? Try adding an additional where condition checking if the field is null or empty.

<cms:CMSRepeater ID="rptProducts" runat="server"
                 Path="/Products/%" 
                 ClassNames="Products.Item" 
                 TransformationName="Product.ProductList"
                 SelectOnlyPublished="true" 
                 StopProcessing="true"
                 PagerControl-PageSize ="4"
                 PagerControl-PageNumbersSeparator=""
                 PagerControl-BackNextStyle="display:none;"
                 EnablePaging="true"
                 ZeroRowsText='<%# CMS.GlobalHelper.ResHelper.GetString("ZeroRowsText") %>' 
                 WhereCondition="Image IS NOT NULL AND Image <> ''" 
    />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top