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

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 31 2025 01:16:14
Script start
Timing: Jan 31 2025 01:16:14
Module start 'layout'
Timing: Jan 31 2025 01:16:14
Module start 'content'
Timing: Jan 31 2025 01:16:14
Module end 'content'
Timing: Jan 31 2025 01:16:14
Script end

Main resources:

Total runtime0.0278 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 588.3984151.2422
Module start 'layout' 0.00690.0037 739.6406220.7656
Module start 'content' 0.01060.0153 960.40631,001.9922
Module end 'content' 0.02580.0019 1,962.398437.9922
Script end 0.0277  2,000.3906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002910.5701140.0002
Check MTime0.00114.0136140.0001
Mysql Total
Database connection0.00113.891610.0011
Mysqli_queries0.00186.526430.0006
Looping result0.00000.054110.0000
Template Total0.00155.310.0015
Template load0.00103.538510.0010
Template processing0.00051.682910.0005
Override
Cache load0.00062.129710.0006
General
dbfile0.00113.844480.0001
String conversion0.00000.036140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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