So I have this conditional that works properly for entries with matrix rows:

{if {tech_documents:total_rows search:doc_thumb="IS_EMPTY"} > 0}

However, entries that have no rows for this matrix field throw a template error:


You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}.

Parser State: Invalid Condition: Not enough operands for operator ” > “.

Running: EE 2.9, Matrix 2.6, Assets 2.4

2 Answers 2


EE simply removes any tags corresponding to custom fields that have no data. So by the time EE is ready to parse the outer {if} conditional, it will look like this:

{if  > 0}

Try wrapping the field tag in quotes:

{if '{tech_documents:total_rows search:doc_thumb="IS_EMPTY"}' > 0}
  • I tried that too. Throws a similar error, except the parser statement reads: Unexpected ‘IS_EMPTY’ (VARIABLE); expected RD in Template “hmc_site/tech-info” on line 79 which is the first line of the conditional statement
    – Siebird
    Commented Aug 13, 2014 at 22:44
  • Did you try reversing the single/double quotes? Commented Aug 13, 2014 at 22:45
  • That worked! That's a first for me. Thanks for the help Brandon.
    – Siebird
    Commented Aug 14, 2014 at 0:13
  • @Siebird Sweet! Just updated the code sample above. Commented Aug 14, 2014 at 0:15
  • @BrandonKelly is that something that could be fixed with prep_conditionals(). See the quote by Pascal here: ellislab.com/forums/viewthread/245003/#1065255 Commented Aug 14, 2014 at 7:18

try with below code:

{if tech_documents:total_rows > 0 && search:doc_thumb="IS_EMPTY"}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.