Maybe I am a moron, but i just can't get this to work. Iv anyone can help me... please do so before i start hurting myself... :p I'm working with EE 2.5.5 and Matrix 2.5.2.

I've got a channel called "events". A matrix field assigned to "events" called "dates" (minimum rows = 0). "Dates" has 3 colums, a date column called 'date', a text column called 'city' and a P&T Switch called 'confirmed'.

Each entry has either no date (=no row), one date oder multiple dates. Each 'date' can of course be „in the future“ or „in the past“ since past events don't get deleted.

I'm trying to put out a list of all entries in this channel and ONE date (if conditions are met).

  1. If there is no date specified (=no row) in the matrix field: "no date specified"
  2. If there ARE entries for dates:
    case 1: in the future, i need the next upcoming date
    case 2: all dates in the past, i need "no date specified" again

I have tried everything i can think of but it seems i am not able to use if:else between my matrix tags...

My approach: Getting entries with no date is easy.

{if dates}
   do something...
   no dates found

So far, so good. But when i try to do

    {if dates}
       {dates search:date=">{current_time}" sort="asc" limit="1"}
          {if date} 
             {date format="%d.%m.%Y"} <!-- outputs next upcoming date if there is one -->
             no date specified <!-- THIS does not work. Should get triggered when there 
ARE rows in "dates" but all "date"-values are < current_time =  already happened,  -->
       no date specified <!-- no row -->

Any suggestions? I've spent 4 hours trying everything i could think of... still getting nowhere....

  • David, I'll read this in more detail in a bit and see how I can help - but I'd also recommend first upgrading to Matrix 2.5.3 just to rule out any fixed issues. It's only a small upgrade. I'll be digging into this this morning
    – Lisa
    Mar 26, 2013 at 16:26
  • I'm already on 2.5.3, upgraded EE and Matrix already to the latest version.
    – David Lang
    Mar 27, 2013 at 21:17

2 Answers 2


This will most likely be to do with parse order. Because you're using advanced conditionals they will be parsed late on and probably evaluated after Matrix conditionals are processed.

Give it a try with simple conditionals by just using {if} statements. So:

{if dates != ""}
   do something
{if dates == ""}
   no dates found

(Depending on what type of data is returned from dates you may need to experiment with your conditional checking. It could return a boolean for instance rather than a string)

The same applies to your nested if statement. Apply the same principle.

The above will be processed much earlier in the parse order and that will most likely make the difference.

Let me know what the outcome of that is.

  • But how can I accomplish my goal with just simple conditionals? I'm not having any problems with {dates}, I can't get {date} to work. Since my matrix field can contain {date}'s in the past AND in the future, i need to construct a query to sort that out. Like: Are there {date}'s? No? "no dates". Yes? If there are, are any of them in the future? If yes, display the soonest date. If not, display "no dates". I can't figure out how to do this with simple conditionals... sorry.
    – David Lang
    Mar 25, 2013 at 19:37
  • Negating logic. :) At this point it's just to test. If it works then you know it's parse order and the first point to figuring out a solution is to identify the problem. Start off simple with a conditional like that and see if that works first.
    – Ian Young
    Mar 25, 2013 at 19:41
  • yeah i got that. but {if dates} dates! {if:else} no dates {/if} already works for me :)
    – David Lang
    Mar 25, 2013 at 19:43
  • my code looks like this atm: {if dates != ""} {dates search:date="IS_EMPTY" sort="asc"} EMPTY {/dates} {dates search:date=">={current_time}" sort="asc" limit="1"} {date format="%d.%m.%Y"} {/dates} {/if} {if dates == ""} NO ROW {/if} it works. except for entries with JUST dates in the past of course.
    – David Lang
    Mar 25, 2013 at 19:46
  • Have you tried just putting in {date} and {current_time} to ensure they're in the same time format - that may have implications to the search parameter. Mar 25, 2013 at 20:02

The search: parameter mimics the EE search parameter. That means it only searches Text Input, Textarea, and Drop-down fields ([search: parameter])1

I see here that you're trying to search on a date type column. It sounds like that may be the core problem. If you run a few of these as plain tests against one of the supported fields, do you get more expected results?

  • Yes I know, I've read the search:fieldname documentation. The stragne thing is: It 'kind of' works. {if date} does indeed give the result I'd expect, {if:else} just doesn't get triggered if there is no entry > current_time. Since both values (date and current_time) are integer... is there any other way I could get this to work? My last resort would be to write the mySQL query myself.
    – David Lang
    Mar 27, 2013 at 21:22
  • It looks like I just can't use advanced conditionals... and without an if:else I'm not going to get the output I'm looking for.
    – David Lang
    Mar 27, 2013 at 21:57
  • David - I saw above that you were using the search: parameter - what is your code for just the conditionals, when not using the search: parameter? Given what you need to accomplish here, I also somewhat wonder if an add-on targeted at event handling might be more appropriate?
    – Lisa
    Mar 27, 2013 at 22:21

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.