• Resolved Albert Fitussi

    (@albert78400)


    Hello
    I would like to select a record that has several dates fields when at least one of those dates is older than 3 months ago.

    Short code with filter :
    [pdb_list template=edit-link search=true filter=” date1<-3_months&date2<-3_months “]

    generated in log :
    SELECT ….WHERE p.date1 < CAST(1604188800 AS SIGNED) AND p.date2 < CAST(1604188800 AS SIGNED) ORDER BY….

    my problem :
    when one of the dates is NULL (not filled in) the result is FALSE no matter what…

    how can I make it work?

    thanks for the help

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author xnau webdesign

    (@xnau)

    I assume that you want a record with a NULL value date to show…in order to do that you need to use an “OR” filter so that if the value is null it is considered a true. You’ll need to figure out the final code you need for your particular situation, but here’s an example of how to do that:

    filter="date1=|date1<-3_months&date2=|date2<-3_months"

    Thread Starter Albert Fitussi

    (@albert78400)

    thanks Roland for your quick answer.
    yes your assumption was correct. and with your indication it does work well.
    (I didn’t know how to write a NULL)
    have a great day

    Thread Starter Albert Fitussi

    (@albert78400)

    Hello Roland
    I am experiencing a surprising result on my list. As of today 25/04/2021. my date format is DD/MM/YYYY.

    starting from a more complex filter that used to work and doesn’t work anymore. I have narrowed down the problem on the date comparisons.

    when I ask for this [pdb_list template=edit-link search=true filter=”date_visite1<-3_months”]

    I get only all records in 2020. records between 01/01/2021 and 25/01/2021 are missing.
    I have double checked that I have 21 records between those dates.

    when I do the same with a <-2_months all the records in February between 01/02/2021 and 25/02/2021 are missing.

    as if the date comparisons would be done only between months and the actual day would not taken into account.

    any clue?
    thanks in advance.
    Albert

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘list filter issue with Null date field’ is closed to new replies.