document listview and date comparison

Benutzeravatar
ounos
Member
Beiträge: 44
Registriert: Mi 6. Aug 2014, 11:09

document listview and date comparison

Beitragvon ounos » Di 11. Aug 2015, 15:33

I would like to achieve something like the following:

Code: Alles auswählen

<we:condition>
    <we:conditionAdd field="myDate" compare=">=" type="now"/>
</we:condition>
using documents. Is that possible somehow ? Otherwise pagination is messed up.

I use pagination and I have to filter my listview with a date field.
If I do that using php code, it works but pagination is messed up. So, I would go for <we:conditionAdd/> tag if it was available for documents (or any other similar solution).

Benutzeravatar
ounos
Member
Beiträge: 44
Registriert: Mi 6. Aug 2014, 11:09

Re: document listview and date comparison

Beitragvon ounos » Mo 17. Aug 2015, 17:16

After some research I ended up using a custom condition in my listview:

Code: Alles auswählen

// Round to current day
$time = time() - (time() % 86400)

<we:listview condition="((myDateField >= $time))">
. . .
</we:listview>
It seems to work pretty fine.
The generated code of the wE condition tags is something like ((myDate >= "142323023")).
Double quotes force MySQL to make a string comparison which is faulty because table column that stores date field (longtext) adds some leading zeros. This should be an integer comparison.

Links:
1. http://stackoverflow.com/questions/4918 ... ysql-query
2. http://stackoverflow.com/questions/6781 ... ers-or-not


Zurück zu „webEdition Basic Version“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 6 Gäste