Forums / Setup & design / list_count problem

list_count problem

Author Message

Michel Houtermans

Tuesday 10 February 2004 8:17:47 am

I have a class with an attribute that is based on a object relation. Now in a folder I want to count the number of objects of that class where the attribute is equal to a certain string.

numWon=fetch('content',
'list_count',
hash( parent_node_id, $node.node_id,
class_filter_type, include,
attribute_filter, array( 181, '=', 'Closed: Won' ) ) )

It does not count them though. Does this not work when an attribute is an object relation?

Tore Skobba

Tuesday 10 February 2004 9:19:14 am

Hi

I think you need an array more for attribute filter, i.e.:

attribute_filter,array(array(181,'=','Closed: Won'))

Try it, does it work?

Cheers
Tore

Michel Houtermans

Tuesday 10 February 2004 9:54:45 am

Hi, that did not do the trick.

Tore Skobba

Wednesday 11 February 2004 2:32:13 am

Hmm well then do some debug output. Is attribute 181 really stored as 'Closed: Won'? For instance EZSelections are stored as numbers (check the database or print out the content).

hmm you are talking about an object relation, but fecthing from $node.node_id. Think I need some more info in order to understand the specific case you are dealing with.

Cheers
Tore

Michel Houtermans

Thursday 12 February 2004 12:17:46 am

Hi Tore,

I have a class (Trade) with an attribute (Remark) that is an object relation to another class (Trade Remark).

Now I have a folder with objects of class Trade. I want to count the number of objects in this folder where the Remark attribute is "Closed: Won".

Now I noticed that the Closed: Won" has object ID 66 and the attribute Remark has attribute ID 181. So I also tried this:

attribute_filter, array( 181, '=', '66' )

and this

attribute_filter, array( 181, '=', 66 )

But neither give me a count.

Tore Skobba

Thursday 12 February 2004 2:00:19 am

Well, as I can see you are fetching all Trade nodes, I.e. numWon=fetch('content',
'list_count', hash( parent_node_id, $node.node_id. Then trying to count all Trade objects having attribute 181 equal to 'Closed:Won'. I.e. class_filter_type, include,
attribute_filter, array( 181, '=', 'Closed: Won' ) ) ).

However, as I understand you it is the Trade Remark class which has the attribute 181? So in order to count the attribute 181 you will need to fetch objects of class Trade Remark, i.e.

Loop: For each trade object
Fetch the Trade Remark object and check and count number Close: Won.

Michel Houtermans

Thursday 12 February 2004 3:02:41 am

Sorry, i must have written it down confusingly.

Class Trade has ID 21. The class Trade has an attribute Remark with ID 181. This attribute is an object relation to a Class called Trade Remark.

Now in the folder I have several objects of the class Trade. I want to count the objects where the attribute 181 equals "Closed: Won".

Now the "Close: Won" object has Object ID: 66. So could this be the expression:

attribute_filter, array (181, '=', 'Close: Won')

or is this how it works:

attribute_filter, array (181, '=', 66)

or may be this:

attribute_filter, array( array (181, '=', 66) )

eZ debug

Timing: Jan 18 2025 19:30:20
Script start
Timing: Jan 18 2025 19:30:20
Module start 'content'
Timing: Jan 18 2025 19:30:21
Module end 'content'
Timing: Jan 18 2025 19:30:21
Script end

Main resources:

Total runtime0.7132 sec
Peak memory usage4,096.0000 KB
Database Queries70

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0079 587.6094180.8438
Module start 'content' 0.00790.7018 768.4531520.5391
Module end 'content' 0.70970.0034 1,288.992246.1328
Script end 0.7131  1,335.1250 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4335140.0002
Check MTime0.00130.1864140.0001
Mysql Total
Database connection0.00080.107410.0008
Mysqli_queries0.668193.6843700.0095
Looping result0.00060.0884680.0000
Template Total0.685896.220.3429
Template load0.00230.320120.0011
Template processing0.683595.833020.3417
Template load and register function0.00030.037310.0003
states
state_id_array0.00090.130010.0009
state_identifier_array0.00070.101920.0004
Override
Cache load0.00200.2778500.0000
Sytem overhead
Fetch class attribute can translate value0.00070.100520.0004
Fetch class attribute name0.00090.123070.0001
XML
Image XML parsing0.00020.032420.0001
class_abstraction
Instantiating content class attribute0.00000.001270.0000
General
dbfile0.00080.1074120.0001
String conversion0.00000.001130.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
7content/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
5content/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: 5

Time used to render debug report: 0.0001 secs