DMXzone Server Connect Support Product Page
filter with date2 >= Now OR date2 = 1111-11-11
Asked 14 Sep 2016 09:03:14
1
has this question
14 Sep 2016 09:03:14 Hans Haverlach posted:
In server connect filter option I have a couple of filters and want to add two filters wicht check if date2 is >= Now (that works!) OR date2=1111-11-11That does not work, since the OR option breaks all the other filters.
I need this OR only for filter date2>= Now and date2=1111-11-11
In Mysql this is easily done. How come this is not possible with server connect. It is common used.
Or is there an other solution I did not think of?
Please let me know!
Thank you.
Replies
Replied 22 Sep 2016 11:52:30
22 Sep 2016 11:52:30 Hans Haverlach replied:
Any news on this subject? Thank you.
Replied 29 Sep 2016 08:00:56
29 Sep 2016 08:00:56 Teodor Kuduschiev replied:
Hello Hans,
Can you please explain a little more detailed how your conditions should work as i am not sure i got your idea?
Can you please explain a little more detailed how your conditions should work as i am not sure i got your idea?
Replied 29 Sep 2016 09:56:08
29 Sep 2016 09:56:08 Hans Haverlach replied:
HelloTeodor,
I will try to explain:
In de FILTERS tab of the Datasource Query Builder, I have 5 filters:
fp.fp_publish=1
AND content.c_publish=1
AND content.c_archive=0
AND content.c_date2 >= now
OR content.c_date2 = 1111-11-11
The last two filters should be considered ONE:
OR the date2 is in the future(>=now) OR the date2 has a value of '1111-11-11' (which means for the CMS system that it will always be published).
But what happens is that if a record has date2 with value: '1111-11-11' and c_publish=0 the query is TRUE and the record is shown. But that should not be so.
I hope you see/understand what the problem is?
I want all filters applied but the last two should be compared together.
In MySql I would write it like this:
SELECT * FROM content LEFT JOIN fp ON content.c_id=fp.fpcontentid WHERE content.c_publish=1 AND fp.fp_publish=1 AND content.c_archive=0 AND (DATEDIFF(content.c_date2, NOW()) > 0 OR content.c_date2='1111-11-11')
Is this grouping of filter with OR possible?
If not than I strongly suggest/vote for this, because with more complex sites we use it a lot!
I will try to explain:
In de FILTERS tab of the Datasource Query Builder, I have 5 filters:
fp.fp_publish=1
AND content.c_publish=1
AND content.c_archive=0
AND content.c_date2 >= now
OR content.c_date2 = 1111-11-11
The last two filters should be considered ONE:
OR the date2 is in the future(>=now) OR the date2 has a value of '1111-11-11' (which means for the CMS system that it will always be published).
But what happens is that if a record has date2 with value: '1111-11-11' and c_publish=0 the query is TRUE and the record is shown. But that should not be so.
I hope you see/understand what the problem is?
I want all filters applied but the last two should be compared together.
In MySql I would write it like this:
SELECT * FROM content LEFT JOIN fp ON content.c_id=fp.fpcontentid WHERE content.c_publish=1 AND fp.fp_publish=1 AND content.c_archive=0 AND (DATEDIFF(content.c_date2, NOW()) > 0 OR content.c_date2='1111-11-11')
Is this grouping of filter with OR possible?
If not than I strongly suggest/vote for this, because with more complex sites we use it a lot!
Replied 29 Sep 2016 10:16:21
29 Sep 2016 10:16:21 Teodor Kuduschiev replied:
Unfortunately nested filters are not yet supported in the query builder
This will soon be included in some of the upcoming Server Connect updates.
This will soon be included in some of the upcoming Server Connect updates.
Replied 30 Sep 2016 07:41:45
30 Sep 2016 07:41:45 Hans Haverlach replied:
Okay, thank you letting me know. Looking forward to the updates! You are doing a great job!