Fetch node by aggregation function on attribute

Author Message

Jan Komárek

Friday 05 December 2008 2:17:53 am

Hello,

I need to fetch node with highest value of attribute. In SQL qouery its easy

SELECT MAX(attribute) as whatever FROM ... 

But I have no idea how to do this in template functions or operators.

Thank you very much for your answer.

Ivo Lukac

Friday 05 December 2008 2:40:46 am

Hello Jan,

Did you try to fetch list function with sorting by this attribute and limit 1?

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

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 19:18:50
Script start
Timing: Jan 18 2025 19:18:50
Module start 'layout'
Timing: Jan 18 2025 19:18:50
Module start 'content'
Timing: Jan 18 2025 19:18:52
Module end 'content'
Timing: Jan 18 2025 19:18:52
Script end

Main resources:

Total runtime1.2472 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0081 589.1797152.6406
Module start 'layout' 0.00810.0024 741.820339.4922
Module start 'content' 0.01051.2352 781.3125529.9219
Module end 'content' 1.24570.0015 1,311.23448.1250
Script end 1.2472  1,319.3594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2802160.0002
Check MTime0.00140.1143160.0001
Mysql Total
Database connection0.00220.176510.0022
Mysqli_queries1.193695.7041540.0221
Looping result0.00160.1283520.0000
Template Total1.206796.720.6033
Template load0.00230.185920.0012
Template processing1.204396.561420.6022
Template load and register function0.00020.012210.0002
states
state_id_array0.00150.120710.0015
state_identifier_array0.00160.128720.0008
Override
Cache load0.00190.1556130.0001
Sytem overhead
Fetch class attribute can translate value0.00060.051720.0003
Fetch class attribute name0.00100.079840.0002
XML
Image XML parsing0.00270.213720.0013
class_abstraction
Instantiating content class attribute0.00000.000640.0000
General
dbfile0.00240.1906220.0001
String conversion0.00000.000540.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs