Fetch the content of a Matrix and display them

Author Message

Softriva .com

Thursday 30 November 2006 8:25:52 am

My class has the following attributes:

Class: Dept

Dept_Name
Dept_Emp (Matrix of one col)

Dept Name: FIN
Dept_Emp->Matrix= (Joe, Mike, Jack)

Dept_Name: HR
Dept_Emp->Matrix=(John, Jeff, Suzan)

How can I fetch only the employees names then display them regardless if there are duplicate names or not.

Claudia Kosny

Saturday 02 December 2006 3:32:50 am

Hi OOzy

The content of an ezmatrix attribute is an object of type ezmatrix. Here you can see what attributes this object has: http://ez.no/doc/ez_publish/technical_manual/3_8/reference/objects/ezmatrix

So if you matrix has only one column I think it should be sufficient to use
...data_map.dept_emp.content.cells. This should give you an array of all entries in the matrix. Then just loop over this array using foreach and you are done.

Claudia

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 00:30:28
Script start
Timing: Jan 19 2025 00:30:28
Module start 'layout'
Timing: Jan 19 2025 00:30:28
Module start 'content'
Timing: Jan 19 2025 00:30:29
Module end 'content'
Timing: Jan 19 2025 00:30:29
Script end

Main resources:

Total runtime0.9608 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.0062 588.0469152.6406
Module start 'layout' 0.00620.0043 740.687539.4922
Module start 'content' 0.01050.9483 780.1797461.2500
Module end 'content' 0.95880.0020 1,241.42978.1250
Script end 0.9607  1,249.5547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.3756160.0002
Check MTime0.00160.1650160.0001
Mysql Total
Database connection0.00100.104710.0010
Mysqli_queries0.912094.9218540.0169
Looping result0.00060.0652520.0000
Template Total0.917795.520.4588
Template load0.00220.232320.0011
Template processing0.915495.279120.4577
Template load and register function0.00030.029010.0003
states
state_id_array0.00170.177810.0017
state_identifier_array0.00280.288520.0014
Override
Cache load0.00180.1898180.0001
Sytem overhead
Fetch class attribute can translate value0.00070.068120.0003
Fetch class attribute name0.00220.231320.0011
XML
Image XML parsing0.00020.025820.0001
class_abstraction
Instantiating content class attribute0.00000.000720.0000
General
dbfile0.00070.0768100.0001
String conversion0.00000.001140.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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/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: 14
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs