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

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 19 2025 09:08:25
Script start
Timing: Jan 19 2025 09:08:25
Module start 'layout'
Timing: Jan 19 2025 09:08:25
Module start 'content'
Timing: Jan 19 2025 09:08:26
Module end 'content'
Timing: Jan 19 2025 09:08:26
Script end

Main resources:

Total runtime1.2647 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 589.1563152.6250
Module start 'layout' 0.00620.0030 741.781339.4453
Module start 'content' 0.00931.2539 781.2266540.5234
Module end 'content' 1.26320.0014 1,321.750012.1641
Script end 1.2646  1,333.9141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2693160.0002
Check MTime0.00140.1109160.0001
Mysql Total
Database connection0.00100.081610.0010
Mysqli_queries1.211195.7683570.0212
Looping result0.00060.0502550.0000
Template Total1.235197.720.6176
Template load0.00210.162820.0010
Template processing1.233197.501120.6165
Template load and register function0.00010.011610.0001
states
state_id_array0.00070.056310.0007
state_identifier_array0.00120.092820.0006
Override
Cache load0.00170.1321430.0000
Sytem overhead
Fetch class attribute can translate value0.00060.049020.0003
Fetch class attribute name0.00100.082340.0003
XML
Image XML parsing0.00070.058620.0004
class_abstraction
Instantiating content class attribute0.00000.000640.0000
General
dbfile0.00090.0720160.0001
String conversion0.00000.000940.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
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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs