Forums / General / Fetch class with changing attribute filter parameters

Fetch class with changing attribute filter parameters

Author Message

Kristoffer Raun

Sunday 01 October 2006 6:19:24 am

Hi

I'm trying to fetch all class 19.
In my class i have a single selection drop down box, where one can select between 15 different options.
For each option there can be several documents where the option has been selected.
I want to fetch the data corresponding to selection 0 first (prehaps several objects), then commence to selection 1, and so on.

This is my problem part:

{section loop=fetch('content','list',hash(parent_node_id,$node.node_id,class_filter_array,array(19),'sort_by', array( 'published', false() ) ,'attribute_filter', array(array( 'rekordfisk/fiskeart_rekord', '=', '$num:index' ))))}

I have defined $num:index as a inc. number, from 0 to 14 and i want to fetch all the objects of the class 19 with eg. selection 0, then selection 1 and so on

My code should do the following
Fetch all class 19 with selection 0 on, sorted by publishing date
Fetch all class 19 with selection 1 on, sorted by publishing date
Fetch all class 19 with selection 2 on, sorted by publishing date
.............

does the explanation makes sense? (I'm affraid it's a bit unclear)

full code below:

Thanks in advance

{let fiskclass=fetch('content','list',hash(parent_node_id,$node.node_id,class_filter_array,array(19)))}

{section  name=num loop=15}
{$num:index}

{let fishnew=1}
{let fishold=1}
{section loop=fetch('content','list',hash(parent_node_id,$node.node_id,class_filter_array,array(19),'sort_by', array( 'published', false() ) ,'attribute_filter', array(array( 'rekordfisk/fiskeart_rekord', '=', '$num:index' ))))}

{switch match=$num:fishnew}
	{case match=1}

<b>{attribute_view_gui attribute=$:item.object.data_map.fiskeart_rekord}</b><br>
Fisken vejede: {attribute_view_gui attribute=$:item.object.data_map.fiskevaegt_rekord} kg.<br>
Længden af fisken: {attribute_view_gui attribute=$:item.object.data_map.fiskelaengde_rekord} cm.<br>
Fanget af: {attribute_view_gui attribute=$:item.object.data_map.fiskeuvnavn_rekord}<br><br>
{set fishnew=2}
	{/case}
	
	{case match=2}
		
{switch match=$num:fishold}
	{case match=1}
	De(n) gamle rekord(er) var:<br>
{attribute_view_gui attribute=$:item.object.data_map.fiskeuvnavn_rekord}, {attribute_view_gui attribute=$:item.object.data_map.fiskevaegt_rekord} kg., {attribute_view_gui attribute=$:item.object.data_map.fiskelaengde_rekord} cm.<br>
{set fishold=2}
	{/case}
	
	{case match=2}
	
{attribute_view_gui attribute=$:item.object.data_map.fiskeuvnavn_rekord}, {attribute_view_gui attribute=$:item.object.data_map.fiskevaegt_rekord} kg., {attribute_view_gui attribute=$:item.object.data_map.fiskelaengde_rekord} cm.<br>

	{/case}

{/switch}


	{/case}

{/switch}

{/section}
--------------------------------------------<br>
{/let}
{/let}
{/section}
{/let}

<i>If you can't describe what you are doing as a process, you don't know what you're doing.</i>
W. Edwards Deming

Xavier Dutoit

Sunday 01 October 2006 7:57:19 am

Not sure what you want to do, but have a look at the enhanced object relation contrib,

http://ez.no/community/contribs/datatypes/enhanced_objectrelation

With the reverse relation fetch, you can get all the objects that have selected a specific item.

X+

http://www.sydesy.com

eZ debug

Timing: Jan 18 2025 10:17:52
Script start
Timing: Jan 18 2025 10:17:52
Module start 'content'
Timing: Jan 18 2025 10:17:53
Module end 'content'
Timing: Jan 18 2025 10:17:53
Script end

Main resources:

Total runtime0.7404 sec
Peak memory usage4,096.0000 KB
Database Queries191

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0074 587.8516180.8203
Module start 'content' 0.00740.5996 768.6719545.5078
Module end 'content' 0.60700.1334 1,314.1797336.7500
Script end 0.7404  1,650.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.5989210.0002
Check MTime0.00170.2262210.0001
Mysql Total
Database connection0.00070.093210.0007
Mysqli_queries0.663089.54811910.0035
Looping result0.00200.27561890.0000
Template Total0.705995.320.3530
Template load0.00230.308220.0011
Template processing0.703695.027220.3518
Template load and register function0.00010.013010.0001
states
state_id_array0.00080.114810.0008
state_identifier_array0.00070.100620.0004
Override
Cache load0.00160.2150270.0001
Sytem overhead
Fetch class attribute can translate value0.00160.210330.0005
Fetch class attribute name0.00090.115340.0002
XML
Image XML parsing0.00290.395530.0010
class_abstraction
Instantiating content class attribute0.00000.000840.0000
General
dbfile0.00801.0805330.0002
String conversion0.00000.001130.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs