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


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
    Aug 13 '14 at 22:44
  • Did you try reversing the single/double quotes? Aug 13 '14 at 22:45
  • That worked! That's a first for me. Thanks for the help Brandon.
    – Siebird
    Aug 14 '14 at 0:13
  • @Siebird Sweet! Just updated the code sample above. Aug 14 '14 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 Aug 14 '14 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, privacy policy and cookie policy

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