Forums / Developer / grouping by an attribute

grouping by an attribute

Author Message

Pablo C. Vergara Castro

Wednesday 18 August 2004 12:05:00 am

Hi to all.

I would like to know the way to make fetch that single gives back objects to me grouped by a certain attribute. For example, I have several objects of a class publication that have an attribute dates, and what I want it is to know the way to extract the dates that are different and in addition to solely be able to count them.

{... 1999 ...},{... 2000 ...},{... 1999 ...},{... 2001 ...},{... 2000 ...} ===> {1999},{2000},{2001}, (3 attributes)

Eirik Alfstad Johansen

Wednesday 18 August 2004 6:54:47 am

Hi Pablo,

I would love to try and help you, but I can't understand what you're trying to do. Could you try to elaborate?

Thanks in advance !

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Pablo C. Vergara Castro

Wednesday 18 August 2004 7:30:06 am

I think that nobody help me because they did not understand my poor English :-(.

What I need to obtain is a query that return the data of diverse objects, but grouped (like group by of SQL) by a certain attribute, this attribute is of text type but store years.

I will develop a little plus the example that I exposed:

Imagine you a set of objects of a certain class that have an attribute of type text which we used to store a year:

Name: Paul
Second_Name:Kristoff
Birth_Year: 1945

Name: Appel
Second_Name:Jobs
Birth_Year: 1955

Name: Sara
Second_Name:Barrer
Birth_Year: 1945

Name: Stephen
Second_Name:Jobs
Birth_Year: 1955

Name: John
Second_Name: John
Birth_Year: 1978

Now I want to obtain by means of fetch (or two)

a) Objects that have the attribute different year.
b) the number of objects that there are with the different year.

Following the example:

a)
Year: 1945
Year: 1955
Year: 1978

b) 3

eZ debug

Timing: Jan 19 2025 06:01:46
Script start
Timing: Jan 19 2025 06:01:46
Module start 'content'
Timing: Jan 19 2025 06:01:48
Module end 'content'
Timing: Jan 19 2025 06:01:48
Script end

Main resources:

Total runtime1.5022 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 590.0781180.8359
Module start 'content' 0.00781.3574 770.9141545.6016
Module end 'content' 1.36520.1369 1,316.5156332.7500
Script end 1.5021  1,649.2656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.2681210.0002
Check MTime0.00150.1024210.0001
Mysql Total
Database connection0.00160.106610.0016
Mysqli_queries1.417794.37721940.0073
Looping result0.00200.13331920.0000
Template Total1.469697.820.7348
Template load0.00210.138820.0010
Template processing1.467597.693320.7338
Template load and register function0.00030.016710.0003
states
state_id_array0.00110.070510.0011
state_identifier_array0.00080.050120.0004
Override
Cache load0.00170.1129430.0000
Sytem overhead
Fetch class attribute can translate value0.00190.125430.0006
Fetch class attribute name0.00170.110540.0004
XML
Image XML parsing0.00140.094430.0005
class_abstraction
Instantiating content class attribute0.00000.001140.0000
General
dbfile0.00920.6094270.0003
String conversion0.00000.000530.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 6

Time used to render debug report: 0.0003 secs