Search
Other Articles Anywhere questions
Forum

Selecting articles on multiple conditions

Ton van Loon's Avatar Ton van Loon
I want to select/filter all the featured articles of category 11 and its child-categories that meet all off the below conditions or that have status=2 ( because status 0 means that dates need to be evaluated, status 2 is the override for the date-evaluation.)
Conditions:
- status=0
- datum-eerste-uitvoering < NOW + 8 days
- datum-laatste-uitvoering > NOW - 1 days


- environment: J4.0.3, articles anywhere 11.1.1PRO-dev2165300

Outcome
I've tried these two code-samples but all samples only show articles that have status = 2, and no articles that meet the mentioned conditions. (Filtering on featured articles off category=11 with children works well)

Who can help me?

- sample 1
{articles category:id="11" include-child-categories="true" featured="true" 
status="0" && datum-eerste-uitvoering="<date('+8 days')" && datum-laatste-uitvoering=">date('-1 days')" || status="2"} 
[title] {/articles}


- sample 2
{articles category:id="11" include-child-categories="true" featured="true" 
status="2"  || status="0" && datum-eerste-uitvoering="<date('+8 days')" && datum-laatste-uitvoering=">date('-1 days')"}  
[title] {/articles}



Narrowing down my problem
Filtering all the featured articles of category 11 and its child-categories that meet only the conditions above conditions (so dropping the optional status=2) does not give any return. For this I tried the code samples 5 and 6.


- sample 3
{articles category:id="11" include-child-categories="true" featured="true" 
status="0" && datum-eerste-uitvoering="<date('+8 days')" && datum-laatste-uitvoering=">date('-1 days')"} 
[title] {/articles}

So my problem must be in the date-conditions. The date conditions of code-sample 3 do work perfectly within an {if}-statement (with slightly different syntax on the date-evaluation according to the documentation):
{if status=0 && datum-eerste-uitvoering < date('+8 days') && datum-laatste-uitvoering > date('-1 days')} [some-code]{/if}

What am I overseeing?
Ton van Loon's Avatar Ton van Loon
I have tested some more. The problem seems to be the lower-then evaluation on dates.

CASE 1: all date in future
Input 1:
Today: 14-11-2021
Date-start datum-eerste-uitvoering: 15-11-2021
Date-end datum-laatste-uitvoering: 20-12-2021

Code 1
{articles category:id="11" include-child-categories="true" featured="true" 
status="0" && datum-eerste-uitvoering=">date('today')" && datum-laatste-uitvoering=">date('today')" 
ordering="datum-eerste-uitvoering ASC"}[title]{/articles}

Expected outcome: title
Outcome: as expected


CASE 2: start date in past (lower-then evaluation!), end date in future
Input 2:
Today: 14-11-2021
Date-start datum-eerste-uitvoering: 12-11-2021
Date-end datum-laatste-uitvoering: 20-12-2021

Code 2
{articles category:id="11" include-child-categories="true" featured="true" 
status="0" && datum-eerste-uitvoering="<date('today')" && datum-laatste-uitvoering=">date('today')" 
ordering="datum-eerste-uitvoering ASC"}[title]{/articles}

Expected outcome: title
Outcome: NOTHING
Peter van Westen's Avatar Peter van Westen ADMIN
If you are using multiple filter groups, you need to repeat all the filters you need in both groups.
So each group is a completely new filter group.
Only the non-filter attributes will be applied to all groups (like the ordering and limits).

If you have a specific final example that does not output what you expect, please reproduce it online and tell me where I can see it.
Also please provide the (s)ftp access so I can look into it...
Please post a rating at the Joomla! Extensions Directory
Ton van Loon's Avatar Ton van Loon
I have done more testing. Problem with above syntax seems based on two issues*. I will make separate bug reports for them. Hence let we close this ticket.

* Suspected issues:
1. Issue on filtering on custom list-field when value:0
2. Issue on filtering on custom date-field with lower-then evaluation.
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription