Forums / Setup & design / Complex attribute_filter in fetch

Complex attribute_filter in fetch

Author Message

Xavier Portebois

Monday 14 May 2007 1:56:51 am

Hello

In order to make some events agenda, I have to filter objects on many criteria :
* publication dates are valid (i.e., begin publication date before now, and end publication date after now)
* event dates belong to the current month

So I get in a fetch an attribute_filter like this one :

...
'attribute_filter',
	array( 'and',
		array('and',
			array('evenement/date_debut', '<=', currentdate()),
			array('evenement/date_fin', '>=', currentdate())
		),		
	array( 'or',
			array( 'evenement/date_debut_evenement', 'between', array( sum($agenda_first_ts,1), sub($agenda_last_ts,1)  )),
			array( 'evenement/date_fin_evenement', 'between', array( sum($agenda_first_ts,1), sub($agenda_last_ts,1) ))
		)
	),
...

There is so a first AND-condition, which links the two conditions blocks :
* an AND-condition between the publication dates
* an OR-condition between the event dates (variables used are ok)

The problem is that I get a notice <i>"attribute filter returns false"</i>, and there's any fetch result.
I tried the first condition (on publication dates), and I got results. I tried then only the second condition (on event dates), and I got results too ; and finally, I know that they are the same event objects, so linking the two conditions with an AND would still get results.
Besides, when I replace the first AND by an OR-condition, I always get the <i>"attribute filter returns false"</i> message... even each condition returns results !

Any idea ? Maybe I write my attribute_filter in a wrong way ?

Frédéric DAVID

Monday 14 May 2007 2:34:28 am

I don't think it's possible.

But you can search to the attribute extended_attribute_filter.

You can find a simple example here : http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/list

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata

Xavier Portebois

Monday 14 May 2007 5:05:09 am

Ok, thanks.

Actually, I found a solution by putting one of my condition in the fecth itself, and then, when I use the results in a <i>foreach</i>, I check the second condition with a simple <i>if</i>.

The results is the same, and thanks to the 1st conditional test I shouldn't loose too much efficiency.

Anyway, thanks for your answer !

eZ debug

Timing: Jan 31 2025 03:31:28
Script start
Timing: Jan 31 2025 03:31:28
Module start 'content'
Timing: Jan 31 2025 03:31:28
Module end 'content'
Timing: Jan 31 2025 03:31:28
Script end

Main resources:

Total runtime0.3010 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0097 587.9531370.2891
Module start 'content' 0.00970.0235 958.24221,001.6563
Module end 'content' 0.03330.2677 1,959.89843,891.9922
Script end 0.3009  5,851.8906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00501.6454200.0002
Check MTime0.00150.4850200.0001
Mysql Total
Database connection0.00100.329210.0010
Mysqli_queries0.166155.17171410.0012
Looping result0.00301.00511390.0000
Template Total0.267188.710.2671
Template load0.00100.333510.0010
Template processing0.266188.388110.2661
Override
Cache load0.00070.235510.0007
Sytem overhead
Fetch class attribute can translate value0.00260.847710.0026
XML
Image XML parsing0.00030.100710.0003
General
dbfile0.030310.0668200.0015
String conversion0.00000.002430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs