Share » Forums » General » How to remove from search result...

How to remove from search result duplicated entries?

How to remove from search result duplicated entries?

Tuesday 07 December 2004 1:25:21 am - 3 replies

Modified on Tuesday 07 December 2004 3:20:00 am by Łukasz Serwatka

Author Message

Silke Fox

Tuesday 07 December 2004 3:16:36 am

Hi Luke,

what do you want to do? Show all possible values of the selection attribute?

If yes, you can do something like this:

{let result=fetch('content','class_attribute',hash('attribute_id',230))}

If no, please tell us more...

Łukasz Serwatka

Tuesday 07 December 2004 3:28:38 am

Hi,

Show all possible values of the selection attribute?

I need to view "type" (attribute value) only for creted objects where lang=value

The class have attributes

1. lang - string
2. type - ezselection (no multiple)

So i looking for objects where attribute "lang" have value "english" and next i need to view "type" of this objects

1. object Lang=english Type=A
2. object Lang=english Type=A
3. object Lang=english Type=B
4. object Lang=english Type=A

Result of this for lang=english

{let SearchType=fetch( content, search, 
               hash( text, $view_parameters.lang,
               class_attribute_id, 230 ) )}

{section loop=$SearchType['SearchResult']}
         {attribute_view_gui 
attribute=$:item.object.data_map.attr_name} <br />
    {/section}

is

A
A
B
A

I need to view unique values

A
B

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

Silke Fox

Tuesday 07 December 2004 5:32:45 am

Okay, I think you're on the right way. Use "append" to build an array with the attribute values and then "unique".

Try something like this (not sure if it will work exactly like this):

{let attrArray=array()}
{section var=Attributes loop=$SearchType['SearchResult']}
{set attrArray=$attrArray|append($Attributes.item.object.data_map.attr_name.content)}
{/section}
{$attrArray|count}
{set attrArray=$attrArray|unique}
{$attrArray|count}
{/let}

Good luck.
silke

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu