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) )

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 22:32:38
Script start
Timing: Jan 18 2025 22:32:38
Module start 'layout'
Timing: Jan 18 2025 22:32:38
Module start 'content'
Timing: Jan 18 2025 22:32:39
Module end 'content'
Timing: Jan 18 2025 22:32:39
Script end

Main resources:

Total runtime1.0009 sec
Peak memory usage4,096.0000 KB
Database Queries69

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 589.3203152.6094
Module start 'layout' 0.00610.0041 741.929739.4141
Module start 'content' 0.01010.9891 781.3438515.4766
Module end 'content' 0.99920.0016 1,296.820316.1875
Script end 1.0008  1,313.0078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3307160.0002
Check MTime0.00130.1259160.0001
Mysql Total
Database connection0.00070.072110.0007
Mysqli_queries0.937993.7136690.0136
Looping result0.00150.1460670.0000
Template Total0.961996.120.4809
Template load0.00220.219620.0011
Template processing0.959795.884020.4798
Template load and register function0.00030.026910.0003
states
state_id_array0.00100.099310.0010
state_identifier_array0.00120.120220.0006
Override
Cache load0.00200.1984500.0000
Sytem overhead
Fetch class attribute can translate value0.00070.073820.0004
Fetch class attribute name0.00170.168170.0002
XML
Image XML parsing0.00030.025820.0001
class_abstraction
Instantiating content class attribute0.00000.001570.0000
General
dbfile0.00070.0707100.0001
String conversion0.00000.004740.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
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: 5

Time used to render debug report: 0.0002 secs