Forums / Developer / Urgent please: How to remove from fetch results duplicated entries?

Urgent please: How to remove from fetch results duplicated entries?

Author Message

Jorge estévez

Wednesday 23 February 2005 7:35:57 pm

Hello

Doing a fetch within several nodes could give as the result several values, some of them are duplicated because they are located in different parts of the node tree in the site.

I would like to remove duplicated values but the array is a multidimensional one (e.g. articles, so the operator used in Arrays "unique" does not remove duplicated entries.

Could someone point out how to do this?
Can someone please give away a code that could perform this?

thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Eirik Alfstad Johansen

Wednesday 23 February 2005 10:29:46 pm

Hi Joe,

If I've understood you correctly, the main_node_only parameter should do the trick.

{let children=fetch(content, list, hash(parent_node_id, 2, main_node_only, true()))}
{/let}

Sincerely,

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

Jorge estévez

Friday 25 February 2005 2:26:45 pm

Sorry, but it does not work...

can someone else point out how to eliminate duplicated entries?

thanks anyway

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Łukasz Serwatka

Saturday 26 February 2005 7:03:20 am

Rebuild multidimensional to one demensional array and then use unique function.

This should work if they have the same node_id (duplicated), If not then you must build array with their names for example.

{let node_array=array()}
{section loop=fetch( content, tree, hash( parent_node_id, 2 ) ) }
    {set node_array=$node_array|append( $item.node_id ) }
{/section}

{section loop=$node_array|unique}
    Loops without duplicated values
{/section}
{/let}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Jorge estévez

Thursday 03 March 2005 3:50:58 pm

Lukasz

I did have to do some workarround but it worked all right..

Thanks a lot for the tip!
It helped a lot!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

liu spider

Sunday 06 March 2005 6:51:57 pm

I use the same approach as Eirik Johansen's, works just fine

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

eZ debug

Timing: Jan 30 2025 22:26:25
Script start
Timing: Jan 30 2025 22:26:25
Module start 'content'
Timing: Jan 30 2025 22:26:25
Module end 'content'
Timing: Jan 30 2025 22:26:26
Script end

Main resources:

Total runtime0.3483 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0072 588.2031370.2578
Module start 'content' 0.00720.0128 958.46091,005.7500
Module end 'content' 0.02010.3282 1,964.21093,894.0859
Script end 0.3482  5,858.2969 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00421.2062200.0002
Check MTime0.00130.3683200.0001
Mysql Total
Database connection0.00060.162810.0006
Mysqli_queries0.239468.72731410.0017
Looping result0.00160.46511390.0000
Template Total0.327794.110.3277
Template load0.00070.207110.0007
Template processing0.326993.874210.3269
Override
Cache load0.00050.143310.0005
Sytem overhead
Fetch class attribute can translate value0.00230.663910.0023
XML
Image XML parsing0.00040.107310.0004
General
dbfile0.01123.2208200.0006
String conversion0.00000.001530.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs