[Acceleo] Removing duplicate in collection [message #897655] |
Tue, 24 July 2012 19:13  |
Eclipse User |
|
|
|
Hi.
I am a beginner in Acceleo and have a "simple" problem.
I write this code:
primeiraOrdem(Conceito, Consulta) :-
[for (elemento : Componentes | aMapaConceitual.elementos->sortedBy(descricao))]
[if (elemento.oclIsTypeOf(Relacao))]
[elemento.descricao/](Conceito, Consulta),
[/if]
[/for]
And i get this results:
primeiraOrdem(Conceito, Consulta) :-
e(Conceito, Consulta),
podeestar(Conceito, Consulta),
podeser(Conceito, Consulta),
quandoesta(Conceito, Consulta),
quandoesta(Conceito, Consulta),
tem(Conceito, Consulta),
tem(Conceito, Consulta).
My question is: "How can I remove the lines that are worded "duplicate" (case of 'quandoesta' and 'tem')?"
I tried everything I could think but not got successful.
Excuse my poor English.
Thank you already.
|
|
|
Re: [Acceleo] Removing duplicate in collection [message #897671 is a reply to message #897655] |
Wed, 25 July 2012 01:06   |
Eclipse User |
|
|
|
Hi
Set is the usual way to force uniqueness, with isUnique() helpful in
more complicated scenarios.
You can just change to loop over your names reduced to a set of their values
[for (descricao: String|
aMapaConceitual.elementos->select(oclIsTypeOf(Relacao)).descricao->asSet()->sortedBy(descricao
| descricao))]
[descricao/](Conceito, Consulta),
[/for]
oclIsKindOf is generally better than oclIsTypeOf, in which case filter()
would be better. (In Juno OCL adds selectByType and selectByKind as well).
Regards
Ed Willink
On 25/07/2012 00:13, Wagner de Andrade Perin wrote:
> Hi.
>
> I am a beginner in Acceleo and have a "simple" problem.
>
> I write this code:
>
> primeiraOrdem(Conceito, Consulta) :-
> [for (elemento : Componentes |
> aMapaConceitual.elementos->sortedBy(descricao))]
> [if (elemento.oclIsTypeOf(Relacao))]
> [elemento.descricao/](Conceito, Consulta),
> [/if]
> [/for]
>
> And i get this results:
> primeiraOrdem(Conceito, Consulta) :-
> e(Conceito, Consulta),
> podeestar(Conceito, Consulta),
> podeser(Conceito, Consulta),
> quandoesta(Conceito, Consulta),
> quandoesta(Conceito, Consulta),
> tem(Conceito, Consulta),
> tem(Conceito, Consulta).
>
> My question is: "How can I remove the lines that are worded
> "duplicate" (case of 'quandoesta' and 'tem')?"
>
> I tried everything I could think but not got successful.
>
> Excuse my poor English.
>
> Thank you already.
|
|
|
|
How to Remove Duplicates Using Advance Filter? [message #1624972 is a reply to message #897655] |
Thu, 19 February 2015 23:27  |
Eclipse User |
|
|
|
Removing duplicates is one of the important tasks, when we work with database in excel. Many times you encounter a situation where you need to remove duplicate records/data. In the following article we tried explaining you 'How to remove duplicates using Advanced Filter', hope this articles helps you!
1 Data before removing duplicates.
2 Data after removing duplicates.
Let us follow step by step process for removing duplicates using Advanced Filter.
1 Select a cell in your data set and choose Data from menu.
2 Select Filter and select Advanced from Sort and Filter group.
3 Advanced Filter dialogue box appears.
4 Enter the range of data containing duplicates in the box provided for List range.
Here the List range is '$B$3:$C$16'.
5 Check the box Unique Records Only and click OK.
|
|
|
Powered by
FUDForum. Page generated in 0.03617 seconds