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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 15:13:25
Script start
Timing: Jan 18 2025 15:13:25
Module start 'layout'
Timing: Jan 18 2025 15:13:25
Module start 'content'
Timing: Jan 18 2025 15:13:25
Module end 'content'
Timing: Jan 18 2025 15:13:25
Script end

Main resources:

Total runtime0.0130 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.0547152.6406
Module start 'layout' 0.00470.0022 740.695339.4766
Module start 'content' 0.00680.0043 780.171993.4609
Module end 'content' 0.01110.0018 873.632834.3047
Script end 0.0129  907.9375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002317.6452140.0002
Check MTime0.00107.5473140.0001
Mysql Total
Database connection0.00075.125210.0007
Mysqli_queries0.001914.852030.0006
Looping result0.00000.084510.0000
Template Total0.001511.510.0015
Template load0.00086.205810.0008
Template processing0.00075.264910.0007
Override
Cache load0.00064.292810.0006
General
dbfile0.00021.725680.0000
String conversion0.00000.047840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

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

Time used to render debug report: 0.0001 secs